IT Nota

  • Home
  • How To
  • .NET
  • WordPress
  • Contact

How to Remove .NET Runtime and SDK on Mac

Check Installation

Determine which version is installed with the command line.

According to Microsoft documentation, we need to remove the SDKs and runtimes separately:

Pay attention to the difference in installed locations between the Intel Mac vs. Silicon M series chip.

Arm-based mac: /usr/local/share/dotnet/
Intel-based mac: /usr/local/share/dotnet/x64/dotnet/

In this example, I want to remove the .NET 6 RC on an M1 silicon Mac from previous test.

% dotnet --list-runtimes
Microsoft.AspNetCore.App 6.0.0-rc.1.21452.15 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.0-rc.1.21451.13 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

% dotnet --list-sdks
6.0.100-rc.1.21463.6 [/usr/local/share/dotnet/sdk]

Uninstall .NET

From the example above, we’ll remove all instances. All these commands can be entered all at once in the Terminal, it will ask you to enter sudo password just once.

sudo rm -rf /usr/local/share/dotnet/sdk/$version
sudo rm -rf /usr/local/share/dotnet/shared/Microsoft.NETCore.App/$version
sudo rm -rf /usr/local/dotnet/shared/Microsoft.AspNetCore.All/$version
sudo rm -rf /usr/local/share/dotnet/shared/Microsoft.AspNetCore.App/$version
sudo rm -rf /usr/local/share/dotnet/host/fxr/$version

That’s it.

You can re-run the dotnet –list-runtimes and dotnet –list-sdks to verify that there’s no longer any .NET installed. You should see something similar to this:

% dotnet --list-runtimes                          
A fatal error occurred. The folder [/usr/local/share/dotnet/host/fxr] does not exist

% dotnet --list-sdks
A fatal error occurred. The folder [/usr/local/share/dotnet/host/fxr] does not exist

Now you can install the new version for your .NET development.

Further Reading

How to remove the .NET Runtime and SDK
How to Check Installed .NET Core Version
Trying .NET 6 Preview on macOS Silicon M1

March 15, 2022 Filed Under: How To Tagged With: .NET, macOS, Microsoft

How to Show Hidden Folders and Files in Mac Finder

This gets asked a lot especially from someone who just switched from Windows to macOS. When you open a New Finder Window on your mac. You might want to see all the hidden files in your folder as well.

The quickest way to do it is just by using a keyboard shortcut:

  1. Open a New Finder Window on the folder where you want to see the hidden files.
  2. Press ⌘ Command + ⇧ Shift + . (Period). To be exact, hold down the Command and Shift keys together, then press the Period key.
  3. The hidden files and folders will appear semi-transparent in the finder (see below).

Hidden Folders and Files in Mac Finder, Before and After

Of course, some people may find it too distracting, in which case you can always hide them again by using the same keyboard shortcut.

February 1, 2022 Filed Under: How To Tagged With: macOS

How to Install Fonts on macOS using Homebrew

If you have used Homebrew to manage your packages, you can also use it to install fonts on your macOS so long as the fonts are available. And as you’ll see in the example below, this is way easier (and quicker) than downloading the fonts and install them conventionally.

If you haven’t, it’s quick to install Homebrew. Just open your Terminal and type in the following:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Homebrew Package Manager installation page

For the latest update of this command, please check Homebrew’s website. You just need to copy the command line and paste it in your Terminal.

Here are some commands you need to know. You need to run this once:

brew tap homebrew/cask-fonts

Then, as I want to try to install some fonts with ligatures from Microsoft such as Cascadia Code and Fira Code, I want to search them first if those fonts are available.

To search the font, you can type in this command:

brew search font- | grep cascadia

Which would give the result (at this time):

font-cascadia-code
font-cascadia-code-pl
font-cascadia-mono
font-cascadia-mono-pl

We’re in luck, it’s available.

Important: The font name is all in lowercase and it’s case-sensitive. For example, you will not find anything if you typed in “Cascadia” as your search word.

Now, we just need to install the Cascadia Font by typing this command:

brew cask install font-cascadia-code

Once completed, your font is installed and active. But in this specific example, if you use Visual Studio Code, even though the font is active, you still need to enable the font ligatures before you can see it.

If you use Sublime Text on the other hand, the change is instant.

That’s all there is to it. So far, we’ve just installed one font Cascadia Code, if you also want to install Fira Code font, you can do it on your own. That would be a good exercise for you.

Additional Note

If you just run the command brew search font- without grep, you will get a list of all available fonts you can install via Homebrew.

Further Reading

How to Enable Font Ligatures in Visual Studio Code

January 21, 2022 Filed Under: How To Tagged With: macOS

Trying .NET 6 Preview on macOS Silicon M1

.NET 6 Banner

Installed on /usr/local/share/dotnet.

Trying to create a new F# project in Terminal.

dotnet new console --language F# -o MyFSharpApp
Welcome to .NET 6.0!
---------------------
SDK Version: 6.0.100-preview.7.21379.14

Telemetry
---------
The .NET tools collect usage data in order to help us improve your experience. It is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.

Read more about .NET CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry

----------------
Installed an ASP.NET Core HTTPS development certificate.
To trust the certificate run 'dotnet dev-certs https --trust' (Windows and macOS only).
Learn about HTTPS: https://aka.ms/dotnet-https
----------------
Write your first app: https://aka.ms/dotnet-hello-world
Find out what's new: https://aka.ms/dotnet-whats-new
Explore documentation: https://aka.ms/dotnet-docs
Report issues and find source on GitHub: https://github.com/dotnet/core
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
--------------------------------------------------------------------------------------
The template "Console Application" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on /Users/ITNota/Documents/Git/fsharp/MyFSharpApp/MyFSharpApp.fsproj...
  Determining projects to restore...
  Restored /Users/ITNota/Documents/Git/fsharp/MyFSharpApp/MyFSharpApp.fsproj (in 1.76 sec).
Restore succeeded.

Further Reading

If you need to uninstall the SDK when the release is out:

How to Remove .NET Runtime and SDK on Mac
Remove / Uninstall .NET SDK on macOS

August 23, 2021 Filed Under: .NET Tagged With: .NET, FSharp, macOS

How to Use cURL HTTP/2 on macOS

cURL is one of most powerful tools for testing HTTP traffic. We typically use cURL to interact with HTTP APIs or test websites.

Although cURL supports HTTP/2, the version that’s installed on macOS Sierra does not. Read Update.

If you try to use the --http2 flag, you’ll receive the following error:

$ curl -I --http2 https://www.itnota.com
curl: (1) Unsupported protocol

Fortunately, we can use another installation from Homebrew alongside the default version. To do so, just type the following command in the Terminal window (assuming you already have Homebrew installed):

$ brew install curl —with-nghttp2

That’s it.

Keep in mind that this installation does not replace the default curl in the system and this can be a good or bad thing for you.

If you want to keep things separately, you’re done as you can always call the 2nd curl by typing its full path:

$ /usr/local/opt/curl/bin/curl -I --http2 https://www.itnota.com

If you check the version of the two in this example:

# Default Version
 $ curl --version
curl 7.51.0 (x86_64-apple-darwin16.0) libcurl/7.51.0 SecureTransport zlib/1.2.8
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz UnixSockets 

# Homebrew Version
 $ /usr/local/opt/curl/bin/curl --version
curl 7.54.0 (x86_64-apple-darwin16.6.0) libcurl/7.54.0 OpenSSL/1.0.2l zlib/1.2.8 nghttp2/1.23.1
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 
Features: IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy

If you want to set the curl you installed from Homebrew as the default, keep reading.

Set Homebrew cURL as the Default

There are several ways to set the new version as your default curl, but I believe the best and safest way to do it was already suggested at the end of installation process.

Notice that after installing the curl from Homebrew you’ll see a warning and instruction. If you missed it, it will look similar to this:

Homebrew cURL Installation Instructions

[...]

######################################################################## 100.0%
==> ./configure --disable-silent-rules --prefix=/usr/local/Cellar/curl/7.54.0 --with-==> make install==>
 Caveats
This formula is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have this software first in your PATH run:
  echo 'export PATH="/usr/local/opt/curl/bin:$PATH"' >> ~/.bash_profile

For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/curl/lib
    CPPFLAGS: -I/usr/local/opt/curl/include
For pkg-config to find this software you may need to set:
    PKG_CONFIG_PATH: /usr/local/opt/curl/lib/pkgconfig

[...]

Just following the instruction provided, type in the following:

$ echo 'export PATH="/usr/local/opt/curl/bin:$PATH"' >> ~/.bash_profile

You need to restart terminal and this time if you call curl without the full path, it will run the Homebrew version.

If you need to refer back to the default macOS version, just edit your ~/.bash_profile file by typing the following command:

$ sudo nano ~/.bash_profile

Look for this line:

export PATH="/usr/local/opt/curl/bin:$PATH"

and comment it out like so:

# export PATH="/usr/local/opt/curl/bin:$PATH"

And press CTRL-X and Yes to exit and save it.

Now you can test it using —http2 flag:

$ curl -I --http2 https://www.itnota.com

Update

Update on 5/21/2019: There are two updates that render this post obsolete.

First update is that the version of curl installed on macOS now supports HTTP/2.

The second update is that Homebrew has removed the –with-nghttp2 option from curl which makes the instructions not accurate.

You can still follow the instructions above for Homebrew version of curl only if you substitute it with the curl-openssl and its corresponding path instead.

So you can uninstall Homebrew curl by running the following:

$ brew uninstall curl

Then install curl-openssl by running the following:

$ brew install curl-openssl

That’s it. You don’t even need to specify any flag such as --with-nghttp2 on the curl-openssl install. It will just work. You just need to pay attention to the path where the curl is installed. It is

/usr/local/opt/curl-openssl/bin/curl

The latest comparison between the two versions of curl:

# Default Version
 $ curl --version
curl 7.54.0 (x86_64-apple-darwin18.0) libcurl/7.54.0 LibreSSL/2.6.5 zlib/1.2.11 nghttp2/1.24.1
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz HTTP2 UnixSockets HTTPS-proxy 

# Homebrew Version
 $ /usr/local/opt/curl-openssl/bin/curl --version
curl 7.65.0 (x86_64-apple-darwin18.6.0) libcurl/7.65.0 OpenSSL/1.0.2r zlib/1.2.11 brotli/1.0.7 c-ares/1.15.0 libssh2/1.8.2 nghttp2/1.38.0 librtmp/2.3
Release-Date: 2019-05-22
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IPv6 Kerberos Largefile libz Metalink NTLM NTLM_WB SPNEGO SSL TLS-SRP UnixSockets

Further Reading

brew install curl –with-nghttp2 errors saying “invalid option: –with-nghttp2”

June 10, 2017 Filed Under: How To Tagged With: Internet, macOS

« Previous Page
Next Page »
Buy me a coffee Support this site
Buy Me a Coffee?

Categories

  • .NET
  • Coding
  • Cybersecurity
  • Database
  • How To
  • Internet
  • Multimedia
  • Photography
  • Programming
  • Resources
  • Review
  • Tips and Tricks
  • Uncategorized
  • Use Case
  • WordPress
  • Writing

Recent Posts

  • How to View Stored Procedure Code in SQL Server
  • How to Find a String in SQL Server Stored Procedures
  • How to Remove Cached Credentials without Rebooting Windows
  • ESP Work Automation: Empowering Enterprises with Streamlined Workflows and Operational Efficiency
  • How to Search for a String in All Tables in a Database

Recent Posts

  • How to View Stored Procedure Code in SQL Server
  • How to Find a String in SQL Server Stored Procedures
  • How to Remove Cached Credentials without Rebooting Windows
  • ESP Work Automation: Empowering Enterprises with Streamlined Workflows and Operational Efficiency
  • How to Search for a String in All Tables in a Database

Tags

.NET .NET Core AdSense ASP.NET Cdonts Dll Classic ASP Code Editor ETL FSharp Genesis Framework Git Google HP Asset Manager HTML5 Hugo IIS Information Security Internet Internet Information Services iOS JAMStack Linux macOS Microsoft Microsoft SQL Server MVC PHP PowerShell Python Simple Mail Transfer Protocol Smtp Server SQL SQL Server SSIS SSMS SSRS Sublime Text Visual Studio Visual Studio Code VPN Windows Windows 8 Windows 10 Windows 2012 Windows Server

Copyright © 2011-2025 IT Nota. All rights reserved. Terms of Use | Privacy Policy | Disclosure