The issue user encountering is because the `dotnet-install.sh` script installs the .NET SDK to a specific location (`/Users/l1x/.dotnet`), and this installation is not picked up by the system-wide `dotnet` command, which is looking for SDKs in `/usr/local/share/dotnet/sdk`.
To ensure that the `dotnet` command recognizes the SDKs installed via `dotnet-install.sh`, you need to adjust environment’s PATH to include the directory where the `dotnet-install.sh` script installs the SDK. Here are the steps to resolve this:
### Step-by-Step Guide:
1. **Add .NET SDK to PATH:**
Open shell profile file. This could be `.bashrc`, `.bash_profile`, `.zshrc`, or another file depending on the shell you’re using. For example, if you’re using `zsh`, you would edit `.zshrc`.
```sh
nano ~/.zshrc
```
Add the following line to include the installation path in PATH environment variable:
```sh
export PATH="$HOME/.dotnet:$PATH"
```
Save the file and exit the editor.
2. **Reload the Shell Configuration:**
Apply the changes by sourcing the profile file:
```sh
source ~/.zshrc
```
If you’re using `bash`, you would source the `.bashrc` or `.bash_profile` file accordingly:
```sh
source ~/.bashrc
```
3. **Verify the Installation:**
Now, run the following command to verify that the .NET SDK installed via `dotnet-install.sh` is recognized:
```sh
dotnet --list-sdks
```
You should see `5.0.100` listed along with the other SDKs.
### Recommended Installation Method:
For a more straightforward and persistent installation, it is recommended to use the official .NET installers provided by Microsoft. These installers automatically handle the PATH configuration and ensure that the SDKs are properly installed and recognized by the `dotnet` command.
1. **Download the .NET SDK Installer:**
Visit the [.NET download page](https://dotnet.microsoft.com/download) and download the installer for .NET 5.0 for macOS.
2. **Run the Installer:**
Follow the instructions in the installer to complete the installation.
3. **Verify the Installation:**
After installation, run:
```sh
dotnet --list-sdks
```
You should see the newly installed SDK listed.
By following these steps, you ensure that the .NET SDK is installed correctly and recognized by the `dotnet` command on Mac.