As a heavy Windows-centric developer, I recently bought a new Macbook Pro (just before the new 16" was launched!). It was my second time using Mac. The first time, I used only Windows through Bootcamp. This time, I'm trying to migrate my development experience to Mac from Windows as a .NET developer. It's still on-going, but I wrote a couple of toy projects on Mac OS. I think it's good to share my personal experience of how I did the transition from Windows to Mac.
Basic Development Environment Setup
I had no idea where to start to set-up the development environment, for the first time. But I found a good post (in Korean) for the initial setup. Therefore, I just followed most of the setup instructions from the post.
Keyboard Remapping
One of the most frustrating moments when switching to Mac from Windows could be the keyboard layout. The layout of the Control key, Option key and Command key is completely different, and I don't think I'm going to be used to the layout anytime soon. Therefore, I have to remap those keys to continue my Windows development experience.
Karabiner-Elements
Karabiner-Elements is a completely free app. It is really excellent for key remapping. I used this for my keyboard layout realignment.
Fn
Key: Changed to LeftCommand
Key- Left
Control
Key: Changed toFn
Key - Left
Command
Key: Changed to LeftControl
Key - Right
Command
Key: Changed toF13
Key
After this remapping, both the left command
key and fn
key combination gets pretty similar to the one in Windows. Therefore, the Command
+ C
and Command
+ V
sequence have become really natural. By the way, what's the purpose of the right Command
Key mapping to F13
Key?
System Keyboard Input Source Shortcut
The F13
key doesn't exist on Windows. I don't know how this key is used on Mac, either, but it seems to be a reserved key for another purpose. As a bilingual developer, I switch both Korean and English every 5 to 10 mins. And this IME switching on Windows is the right Alt
key. Therefore, I remapped the right Command
key to F13
and changed the input source switch shortcut to F13
like below:
Now, I have the exactly the same experience as Windows to change the input language source.
Better Snap Tool
Mac OS provides the screen split view feature, but it's fairly basic. If I want more, I need to look for a third-party tool. Better Snap Tool is precisely for this purpose. It doesn't only provide a screen split view from many different perspectives but also provides shortcut features for each split view. The only downside of this tool is that you have to buy this.
Of course, there's an open-source-based tool doing the same thing, like Rectangle. If you're cost-sensitive, it's worth considering.
.NET Core SDK
.NET Core has now been older than three years as a cross-platform and open-source language and framework. The latest version of .NET Core SDK is 3.1.100 (3.1.0)
at the time of this writing. You can download it from the official website. If you prefer to using Homebrew, type the following command to install the latest version of .NET Core SDK.
brew cask install dotnet-sdk |
But, there's a slight issue using Homebrew to install .NET Core SDK. The Cask only contains the latest version of SDK. It's common to target a different version of SDK when developing .NET Core applications. For example, We can write a console app with .NET Core 3.1.0, but at the same time, we might need to develop an Azure Functions app that currently has a target to .NET Core 2.1/2.2. In this case, we have to download and install manually, not through Cask. Fortunately, there's a Tap, called .NET Core SDK Versions. Follow the command below to install multiple version of SDK.
https://gist.github.com/justinyoo/3bfe96fe51b3ea489b5fb25f43c2cf54?file=install-dotnet-sdk.sh
With this Tap, the following command will show up the list of installed .NET Core SDK.
https://gist.github.com/justinyoo/3bfe96fe51b3ea489b5fb25f43c2cf54?file=list-dotnet-sdk.sh
PowerShell Core
PowerShell used to be a scripting language, only running on Windows. It's now open-source and supports cross-platform. Therefore, you can continue the existing PowerShell scripting experience on Mac. Use the Homebrew command to install PowerShell on your Mac.
https://gist.github.com/justinyoo/3bfe96fe51b3ea489b5fb25f43c2cf54?file=install-powershell.sh
Once installed, your default Terminal app turns into the PowerShell mode. If you change the theme of Terminal, it will really give you the same PowerShell console look and feel.
In addition to that, installing Azure PowerShell Module will give more seamless integration by typing the command below:
https://gist.github.com/justinyoo/3bfe96fe51b3ea489b5fb25f43c2cf54?file=install-azure-powershell.sh
Azure CLI
Like Azure PowerShell, Azuer CLI is a cross-platform tool that manages Azure products and services. While developing applications running on Azure, both Azure PowerShell and Azuer CLI are necessary because they complement each other. Therefore installing both would be a good idea. To install Azure CLI, run the following command:
https://gist.github.com/justinyoo/3bfe96fe51b3ea489b5fb25f43c2cf54?file=install-azure-cli.sh
Azurite
Azurite is an emulator for Azure Storage, and an npm
package that running on multiple platforms. If we develop an Azure Functions app, we mostly need Azure Storage account. On Windows, we can use Azure Storage Emulator for local development, but we can't use it on the other platform. Therefore, Azurite is really a useful tool running on cross-platform. At the time of this writing, its latest version is 3.3.0-preview
, but it's not stable yet. So, I would recommend using 2.7.1
instead.
https://gist.github.com/justinyoo/3bfe96fe51b3ea489b5fb25f43c2cf54?file=install-azurite.sh
Once installed, run the following command in the console.
https://gist.github.com/justinyoo/3bfe96fe51b3ea489b5fb25f43c2cf54?file=run-azurite.sh
Azure Storage Explorer
Azure Storage Explorer helps navigate both local and cloud storage services like Azure Storage Account, Cosmos DB and Azure Data Lake. It's also running on multiple platforms. Enter the following command for install.
Once installed, you can see the screen like this:
Docker for Mac
Docker for Mac runs dockerised containers natively on Mac OS. Run the following command to install.
https://gist.github.com/justinyoo/3bfe96fe51b3ea489b5fb25f43c2cf54?file=install-docker.sh
Once installed, you can run the Docker CLI straight away in the console.
If you've been using Virtual Box for Docker, it's time to switch.
GitKraken
Mac OS contains the git CLI out-of-the-box.
But, if you prefer to using GUI, there are many cross-platform tools for it. GitKraken is one of them. It offers a both free and paid version. In most cases, the free version would be sufficient. Run the following command to install GitKraken.
https://gist.github.com/justinyoo/3bfe96fe51b3ea489b5fb25f43c2cf54?file=install-gitkraken.sh
IDE
There are roughly two IDEs on Mac for .NET application development. One is Visual Studio for Mac, and the other is Visual Studio Code.
Visual Studio for Mac
To install Visual Studio for Mac, run the following command with Homebrew.
https://gist.github.com/justinyoo/3bfe96fe51b3ea489b5fb25f43c2cf54?file=install-visual-studio.sh
Once installed, open a solution and you'll be able to see code like that:
However, it's still lack of extensions and has a little mature eco system yet. Therefore, it's tough to catch up with the developer experience that I used to do on Windows. It takes more time to get enough extensions.
Visual Studio Code
Alternatively, we can use Visual Studio Code. It's built for cross-platform and has large extensions pool. Admittedly it can't fully replace Visual Studio, but with many extensions, it can keep up most things. Let's run the following command to install Visual Studio Code.
In fact, VS Code itself is enough for .NET applications. But installing several extensions will give you much relief. Here is the list that I've installed and been using so far. I know the list is not perfect, and it's purely based on my personal experiences. It really has helped me a lot. I wouldn't touch further on each extension here, but add links for them.
- C#
- C# Sort Usings
- C# XML Comments
- Azure Tools
- Azure Logic App
- EditorConfig
- GitLens
- Git History
- Live Share
- PowerShell
- Visual Studio IntelliCode
- Visual Studio Code Icons
- SVG Viewer
Once these tools are ready, we can create a .NET Core project by running the following commands.
https://gist.github.com/justinyoo/3bfe96fe51b3ea489b5fb25f43c2cf54?file=create-dotnet-project.sh
We've now got a new .NET Core project from dotnet CLI. Open the project with Visual Studio Code to put more codes.
Postman
Postman is still widely used for API development and testing. There are other useful tools as its alternatives. So, feel free to choose the right one for your purpose. The following command allows you to install Postman.
https://gist.github.com/justinyoo/3bfe96fe51b3ea489b5fb25f43c2cf54?file=install-postman.sh
ngrok
ngrok is a handy tool to test webhook APIs on the local machine.
https://gist.github.com/justinyoo/3bfe96fe51b3ea489b5fb25f43c2cf54?file=install-ngrok.sh
In my previous post, I dealt with how to use
ngrok
. It's nice to have a read the post.
The tools introducing below are not for .NET application development but for writing technical documentations.
Snag It
Snag It helps for screenshots. If you think that the default feature on Mac OS is not enough, this will be useful. But make sure that this requires payment. If you are seeking for a free version, you better find out alternatives.
https://gist.github.com/justinyoo/3bfe96fe51b3ea489b5fb25f43c2cf54?file=install-snagit.sh
Camtasia
Camtasia helps for screen recording. Mac OS default feature is still OK, but if you need more features, then consider this tool. Not free.
https://gist.github.com/justinyoo/3bfe96fe51b3ea489b5fb25f43c2cf54?file=install-camtasia.sh
Grammarly
Grammarly is particularly useful for developers who speak English as their second language. It picks up grammatical errors or suggests appropriate words by analysing sentences and contexts. If you are writing some technical documents, Grammarly really will be your best friend.
This supports most modern web browsers, including Microsoft Edge, Mozilla Firefox, and Google Chrome, by providing browser extensions. Alternatively, you can download and install the desktop application,
https://gist.github.com/justinyoo/3bfe96fe51b3ea489b5fb25f43c2cf54?file=install-grammarly.sh
So far, I've discussed several tools running on Mac, to help or improve developer experiences. I hope this document will help myself and others in the future.