Skip to content

Instantly share code, notes, and snippets.

@Ronin1702
Last active September 14, 2023 01:30
Show Gist options
  • Select an option

  • Save Ronin1702/f905bf438ed30bde2f14c43bf45bf7fc to your computer and use it in GitHub Desktop.

Select an option

Save Ronin1702/f905bf438ed30bde2f14c43bf45bf7fc to your computer and use it in GitHub Desktop.
Switching Shell EXPORT path

Switch Homebrew export path between Intel and Apple Silicon

As a developer, you may or may not have set up VMs (Virtual Machines). Developing cross platform we will need to tell our shell such as brew, bash, powershell, or zsh to which path they shall export the command to. So that the shell can translate what you wanted to do from the command line to a language that your machine can understand and execute.

Check Which Shell is being used

For most developers we use the good old Bash instead of zsh, both of them works. To check which shell you're using:

echo $SHELL

If it is not /bin/bash and assuming you're in the $HOME or root directory of your profile, then you may change it by:

chsh -s /bin/bash

Kill then repoen Terminal, it shall be updated to Bash, you can run echo $SHELL again to double check.

Check all registed $PATH

echo $PATH

This will give you all the registered PATHs.

Check current Export PATH for homebrew

which brew

Above command should prints out the current exporting PATH for Homebrew.

From Mac to PC Export Path:

export PATH="/usr/local/bin:${PATH}"

From PC to Mac Export Path:

export PATH="/opt/homebrew/bin:${PATH}"

Make it Stick

You've probably noticed that the methods above are temporary.

In the next update I'll markdown how to make it stick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment