Adding to your PATH with oh-my-zsh

I use oh-my-zsh for my shell.

I keep stuff in ~/bin which is not in the default path for OSX

I thought — let’s be organized and keep my customization in an oh-my-zsh plugin.

Hours of frustration ensue.

In oh-my-zsh, they encourage you to put your custom stuff in

~/.oh-my-zsh/custom/plugins/myplugin/myplugin.plugin.zsh

And then you add this line in ~/.zshrc:

plugins=(git common-aliases myplugin)

And it will get called. However, if you put this in your plugin:

path+=(“$HOME/bin”)
export PATH

It will not take effect.

The reason is that in ~/.zshrc, plugins are called before the path is set, effectively overriding anything the plugins may have done to the path

So just put that path setting in the ~/.zshrc directly


Originally published at http://www.jacobsingh.name on November 22, 2014.

Jacob Singh
CTO in residence at Sequoia Capital. Independent product and Engineering Coach Mediocre guitarist, singer, rock climber, point guard and baker Dedicated dad. American in New Delhi.
New Delhi