Skip to content

Instantly share code, notes, and snippets.

@peterblazejewicz
Last active July 20, 2025 16:01
Show Gist options
  • Save peterblazejewicz/9d08e09c947ba5723fc3fb0c788b21b1 to your computer and use it in GitHub Desktop.
Save peterblazejewicz/9d08e09c947ba5723fc3fb0c788b21b1 to your computer and use it in GitHub Desktop.
A script to be used with JetBrains' Rider on OSX/*nix from Microsoft repositories.

Start Rider with proper setp for MS repositories

This solution is based on existing MS shell scripts that launch VS or VSCode.

Run Rider

One can either run a script located at root directory, included here as an example, passing paths to projects/solutions to be opened by Rider:

startrider.sh ./MyApp.sln

The script can be invoked from other locations within your project, to prepeare Rider to open your current project properly setup:

#!/usr/bin/env bash

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
repo_root="$DIR/../.."
"$repo_root/startrider.sh" $DIR
#!/usr/bin/env bash
# This command launches JetBrains Rider with environment variables required to use a local version of the .NET Core SDK.
# This tells .NET Core to use the same dotnet.exe that build scripts use
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export DOTNET_ROOT="$DIR/.dotnet"
# This tells .NET Core not to go looking for .NET Core in other places
export DOTNET_MULTILEVEL_LOOKUP=0
# Put our local dotnet on PATH first so Rider knows which one to use
export PATH="$DOTNET_ROOT:$PATH"
# Sets TFW for JetBrains Rider usage
export TARGET=net9.0
if [ ! -f "$DOTNET_ROOT/dotnet" ]; then
echo ".NET Core has not yet been installed. Run \`./restore.sh\` to install tools."
exit 1
fi
# Check if Rider is available via command line
if command -v rider >/dev/null 2>&1; then
# Use rider command if available
if [[ $1 == "" ]]; then
rider .
else
rider $1
fi
elif [ -d "/Applications/Rider.app" ]; then
# Use macOS application bundle
if [[ $1 == "" ]]; then
open -a "Rider" .
else
open -a "Rider" $1
fi
else
echo "JetBrains Rider not found. Please ensure Rider is installed and either:"
echo "1. Add 'rider' command to PATH, or"
echo "2. Install Rider.app in /Applications/"
exit 1
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment