{"id":232735,"date":"2021-05-19T13:01:03","date_gmt":"2021-05-19T20:01:03","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/visualstudio\/?p=232735"},"modified":"2021-05-19T13:01:03","modified_gmt":"2021-05-19T20:01:03","slug":"developing-on-a-m1-mac-with-visual-studio-for-mac","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/visualstudio\/developing-on-a-m1-mac-with-visual-studio-for-mac\/","title":{"rendered":"Developing on a M1 Mac with Visual Studio for Mac"},"content":{"rendered":"<p><em>Hi! We <a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/visual-studio-2019-for-mac-version-8-9-is-now-available\/\">recently posted<\/a> about how Visual Studio for Mac is supporting Apple Silicon \/ M1 architecture through the Rosetta translation layer starting in version 8.9, and we&#8217;re working towards native support. We&#8217;ve been using and testing with M1 Macs, but it&#8217;s always great to hear how .NET and Visual Studio for Mac are working for our customers in the real world. We&#8217;ve invited Aaron LaBeau, an MVP and seasoned Mac developer, to share his experiences. Thanks, Aaron!<\/em><\/p>\n<p><em>We&#8217;re continuing to improve the M1 development experience in Visual Studio 8.10 Preview. Please <a href=\"https:\/\/docs.microsoft.com\/visualstudio\/mac\/install-preview?view=vsmac-2019\">try the preview<\/a> and <a href=\"https:\/\/developercommunity.visualstudio.com\/t\/Visual-Studio-for-Mac-plans-for-Apple-M1\/1288531\">let us know your experiences<\/a>!<\/em><\/p>\n<hr \/>\n<p><a href=\"https:\/\/www.apple.com\/newsroom\/2020\/06\/apple-announces-mac-transition-to-apple-silicon\/\">Apple\u2019s recent news<\/a> of switching processors from the Intel x86 family of processors to custom processors has caused a lot of talk among the development community. The M1 processor is a custom ARM 64-bit processor and is based on the popular A series processors that Apple has been designing and shipping in mobile devices for years. Apple is now shipping several models of computers all with M1 processors. I have been using an M1 Mac Mini since the launch of the M1 building software with .NET tools and my experience has been pretty good so far\u2026 <em>for the most part<\/em>. When I tell developers \u201cHey I\u2019m running everything on a M1 Mac Mini,\u201d I get a lot of questions about support of various development tools used to build .NET applications and services that run in Azure.<\/p>\n<p>How does Visual Studio for Mac run on M1? First, keep in mind that I don\u2019t work for Microsoft or Apple, and I\u2019m just sharing my personal experience here. Visual Studio for Mac runs on M1 thanks to a translation layer called Rosetta 2 which translates x86 instructions to ARM64. It\u2019s designed to run without end users noticing it, and \u201cfor the most part\u201d it works like this. The performance feels the same as running on my 2019 MacBook Pro 16\u201d with a i9 Processor fully loaded with max RAM and storage, maybe even faster at times.<\/p>\n<p>You\u2019ve seen me state \u201cfor the most part\u201d several times so far. With any massive change in technology there will be some hiccups. Large complex tools with many dependencies will take time to get ARM64 support fully working. I\u2019m not going to lie, there has been some small amount of pain when using a M1 Mac to develop software. Most of it is around things I\u2019ve had not work and then had to research fixes. I would like to share with you my experiences below.<\/p>\n<h2>Web Developers<\/h2>\n<p>Out of the box Visual Studio for Mac runs great for ASP.NET development of APIs and Razor Webpages. I\u2019ve worked on multiple projects and a few Blazor apps and I\u2019ve been able to open them and debug without issues.<\/p>\n<p><img decoding=\"async\" width=\"917\" height=\"472\" class=\"wp-image-232736\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/graphical-user-interface-application-teams-desc.png\" alt=\"Microsoft Edge download dialog\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/graphical-user-interface-application-teams-desc.png 917w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/graphical-user-interface-application-teams-desc-300x154.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/graphical-user-interface-application-teams-desc-768x395.png 768w\" sizes=\"(max-width: 917px) 100vw, 917px\" \/><\/p>\n<p>When you go to download Edge, select the \u201cMac with Apple chip\u201d version if you have M1 processor and you will get an optimized version of the browser.<\/p>\n<p>As you can see from my screenshot below, I have Microsoft Edge selected to use to debug with and I have the Blazing Pizza app debugging in Visual Studio for Mac without issues.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/Picture1.png\"><img decoding=\"async\" class=\"wp-image-232743 alignnone\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/Picture1.png\" alt=\"Debugging the Blazing Pizza Blazor app in Visual Studio for Mac on a M1 Mac Mini\" width=\"1268\" height=\"783\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/Picture1.png 1544w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/Picture1-300x185.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/Picture1-1024x632.png 1024w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/Picture1-768x474.png 768w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/Picture1-1536x948.png 1536w\" sizes=\"(max-width: 1268px) 100vw, 1268px\" \/><\/a><\/p>\n<p>For those web developers using other open-source software and tools, Homebrew now supports the M1 processor. You can find the download for Homebrew <a href=\"https:\/\/brew.sh\/\">here<\/a>.<\/p>\n<p>While homebrew does support the M1 processor, some tools will not install properly without changes to the way you install them.  You can tell the command line which architecture to use when running commands.  For example, until the <a href=\"https:\/\/nodejs.org\/en\/blog\/release\/v16.0.0\/#:~:text=node.js%20v16.0.0\">Node.js v16.0.0 release (which included ARM support)<\/a>, I used the following syntax to tell Homebrew to install node with  native M1 processor support:<\/p>\n<pre class=\"prettyprint\">arch -arm64 brew install node<\/pre>\n<p>This would tell brew to install the arm version of node. If you wanted to support X86 and use the Rosetta 2 translation layer you could install it with:<\/p>\n<pre class=\"prettyprint\">arch -x86_64 brew install node<\/pre>\n<p>Even running complex projects, like a project based on Jason Taylor\u2019s Clean Architecture .NET Core NuGet package are possible. For this, I simply followed the directions from the <a href=\"https:\/\/github.com\/jasontaylordev\/CleanArchitecture\">GitHub repo<\/a> and thanks to the awesome integrated Terminal support in Visual Studio for Mac I launched the Angular Web App which is node based right within the Terminal in Visual Studio for Mac. The terminal even supports all my custom fonts and colors I have setup in zsh. I don\u2019t know which developer worked on the terminal plugin, but they deserve a virtual high five for this because it\u2019s one of my favorite features in Visual Studio for Mac.<\/p>\n<p><img decoding=\"async\" width=\"1395\" height=\"1009\" class=\"wp-image-232737\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/graphical-user-interface-text-description-automa.png\" alt=\"Visual Studio for Mac debugging an ASP.NET API project while running a Node project from the Terminal\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/graphical-user-interface-text-description-automa.png 1395w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/graphical-user-interface-text-description-automa-300x217.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/graphical-user-interface-text-description-automa-1024x741.png 1024w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/graphical-user-interface-text-description-automa-768x555.png 768w\" sizes=\"(max-width: 1395px) 100vw, 1395px\" \/><\/p>\n<p>Also, did you know that you can open more than one Terminal window in Visual Studio for Mac? This is something I think most people look over and I love that I can have more than one tab open at a time. To open another Terminal tab just click the button on the right side of the window.<\/p>\n<p><img decoding=\"async\" width=\"699\" height=\"279\" class=\"wp-image-232738\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/text-description-automatically-generated.png\" alt=\"Visual Studio for Mac Terminal Window with new Terminal button highlighted\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/text-description-automatically-generated.png 699w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/text-description-automatically-generated-300x120.png 300w\" sizes=\"(max-width: 699px) 100vw, 699px\" \/><\/p>\n<p>I can\u2019t express how much this has helped my workflow given I still use the command line for a lot of things like git.<\/p>\n<h2>Mobile Developers<\/h2>\n<p>On the Xamarin front, life is pretty good unless you\u2019re using Android emulators. The good news is that .<a href=\"https:\/\/devblogs.microsoft.com\/xamarin\/author\/jamesmontemagno\/\">NET expert<\/a>, <a href=\"http:\/\/mergeconflict.fm\/\">Podcast host<\/a>, and <a href=\"https:\/\/www.twitch.tv\/jamesmontemagno\">internet streamer<\/a> James Montemagno has a great article already up on how to work around this which you can read in his <a href=\"https:\/\/montemagno.com\/setting-up-an-m1-mac-for-xamarin-development\/\">blog post<\/a> on how he setup his M1 Mac for Xamarin Development<\/p>\n<p>I would note I did a different work around to get my Android emulators working which involved the following:<\/p>\n<ul>\n<li>Installing Android Studio from the Android Developer Portal (I use this for complex profiling and debugging of mobile apps)<\/li>\n<li>Using the AVD Manager setup a new emulator using the arm64 image<\/li>\n<\/ul>\n<p><img decoding=\"async\" width=\"789\" height=\"496\" class=\"wp-image-232739\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/a-screenshot-of-a-computer-description-automatica.png\" alt=\"Android Development Studio Android Virtual Device Manager (AVD)\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/a-screenshot-of-a-computer-description-automatica.png 789w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/a-screenshot-of-a-computer-description-automatica-300x189.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/a-screenshot-of-a-computer-description-automatica-768x483.png 768w\" sizes=\"(max-width: 789px) 100vw, 789px\" \/><\/p>\n<p>Once I did this \u2013 Visual Studio for Mac saw the device and I could use it to push builds and debug without issues. It\u2019s also very fast for an emulator \u2013 way faster than the emulators I used to use in the past and with Hot Reload working I feel like I can do very rapid mobile development.<\/p>\n<p><img decoding=\"async\" width=\"1539\" height=\"868\" class=\"wp-image-232740\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/graphical-user-interface-text-description-automa-1.png\" alt=\"Visual Studio for Mac with a Xamarin Shell app running Hot Reload on a M1 Mac Mini using ARM Emulator\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/graphical-user-interface-text-description-automa-1.png 1539w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/graphical-user-interface-text-description-automa-1-300x169.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/graphical-user-interface-text-description-automa-1-1024x578.png 1024w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/graphical-user-interface-text-description-automa-1-768x433.png 768w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/graphical-user-interface-text-description-automa-1-1536x866.png 1536w\" sizes=\"(max-width: 1539px) 100vw, 1539px\" \/><\/p>\n<h2>Docker Support<\/h2>\n<p>The one minor pain is Docker support. The Docker Desktop client now runs on an M1 Macs, but most of the docker images have not been updated for the ARM64 architecture. Because of this, running the standard SQL Server in Docker on your local machine isn\u2019t possible today via Docker. I do have a work around though &#8211; Azure SQL Edge has been ported to ARM64 and thus can run on Docker for M1 on your Mac.<\/p>\n<p>A sample on how to get started using this Docker image is:<\/p>\n<pre class=\"prettyprint\">docker run -e \"ACCEPT_EULA=1\" -e 'MSSQL_SA_PASSWORD=P@ssword123' -e \"MSSQL_PID=Developer\" -e \"MSSQL_USER=SA\" -p 1433:1433 -d --name=sql mcr.microsoft.com\/azure-sql-edge<\/pre>\n<p><img decoding=\"async\" width=\"960\" height=\"366\" class=\"wp-image-232741\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/text-description-automatically-generated-1.png\" alt=\"Downloading the Azure SQL Edge Docker image\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/text-description-automatically-generated-1.png 960w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/text-description-automatically-generated-1-300x114.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/text-description-automatically-generated-1-768x293.png 768w\" sizes=\"(max-width: 960px) 100vw, 960px\" \/><\/p>\n<p>Once running you can use Azure Data Studio to connect to the docker image running on localhost (127.0.0.1).<\/p>\n<p><img decoding=\"async\" width=\"1475\" height=\"555\" class=\"wp-image-232742\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/a-screenshot-of-a-computer-description-automatica-1.png\" alt=\"Running Azure Data Studio on a M1 Mac Mini connected to local instance of Azure SQL Edge Docker Image\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/a-screenshot-of-a-computer-description-automatica-1.png 1475w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/a-screenshot-of-a-computer-description-automatica-1-300x113.png 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/a-screenshot-of-a-computer-description-automatica-1-1024x385.png 1024w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2021\/05\/a-screenshot-of-a-computer-description-automatica-1-768x289.png 768w\" sizes=\"(max-width: 1475px) 100vw, 1475px\" \/><\/p>\n<p>I\u2019ve used Azure SQL Edge with Entity Framework Core and EF 5 for testing my ASP.NET Core projects and it works fine on my machine with a standard connection string.<\/p>\n<h2>Honorable Mention: Visual Studio Code<\/h2>\n<p>For those that also use Visual Studio Code \u2013 there is now support for ARM64 and the latest build should have universal support. You can read more about this in the <a href=\"https:\/\/code.visualstudio.com\/updates\/v1_54\">release notes<\/a>.<\/p>\n<h2>Summary<\/h2>\n<p>While the first couple of weeks trying to develop software on a M1 Mac Mini was painful, the entire Microsoft team of development tools have come together to resolve the major problems developing .NET software on a M1 processor. Visual Studio for the Mac runs great on the M1 processor, I\u2019m able to develop using a wide range of technology stacks, and I really like that I don&#8217;t hear my fan start to run every time I start a docker image.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this guest blog post, Aaron LaBeau shares his experiences with developing applications using Visual Studio for Mac on an M1 Mac Mini, and passes along some top tips to get you started.<\/p>\n","protected":false},"author":59927,"featured_media":232740,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[155],"tags":[3743,452],"class_list":["post-232735","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-visual-studio","tag-visual-studio-2019-for-mac","tag-visual-studio-for-mac"],"acf":[],"blog_post_summary":"<p>In this guest blog post, Aaron LaBeau shares his experiences with developing applications using Visual Studio for Mac on an M1 Mac Mini, and passes along some top tips to get you started.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/232735","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/users\/59927"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/comments?post=232735"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/232735\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media\/232740"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media?parent=232735"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/categories?post=232735"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/tags?post=232735"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}