bashrc in Mac OS

If you are working with CUDA or OpenCV on Mac OS, you need to provide proper paths before you compile. And in some cases you need to give these paths every time you open a terminal. In Linux, there is bashrc file in which we can add all the paths. But in Mac OS, I could not find it. We need to create a profile and it loads every time we open a terminal.

To make your own profile, open the terminal and type


sudo vi /etc/bashrc

At the end of this file, add the following line


source ~/.bashrc

Now if you restart the terminal, you get a warning :


-bash: /Users/username/.bashrc: No such file or directory

Now create this file


vim .bashrc

Add whatever the paths you want into this file. For example, I would add

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
export LD_LIBRARY_PATH=/usr

Save the file.

Now restart the terminal. Whenever you start a terminal from now on all the settings in bashrc file are loaded.

Done and done! 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s