Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Console Foundations Environment and Redirection Environment Variables

SERGIO RODRIGUEZ
SERGIO RODRIGUEZ
17,532 Points

Which is the equivalent of .bashrc in a Mac?

I see there is a .bash_profile file but when I nano it, there are only two lines written into it:

alias showFiles='defaults write com.apple.finder AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/Finder.app'
alias hideFiles='defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app'

I wrote down those 2 lines a long time ago to have an easy way to show/hide system files.

any ideas?

2 Answers

.bashrc is perfectly valid on Macs it just may not have been created by default. .bash_profile and .bashrc are both valid config files. You should be making your changes in .bashrc for most things as it is loaded every time a new shell is opened, not just on login.

Ben B
Ben B
994 Points

I didn't use mac in 2015 but I can confirm that .bashrc does NOT execute when I open a terminal in mac sierra 10.12.5. If I run bash after I open a terminal then .bashrc does execute.

Last login: Tue Feb 20 10:07:22 on ttys000
username@usernames-ibm-mbp.raleigh.ibm.com:/Users/username $ env | grep SHELL
SHELL=/bin/bash
username@usernames-mbp.raleigh.ibm.com:/Users/username $ cat .bashrc
alias bashrctest='echo bashrc was read'
username@usernames-mbp.raleigh.ibm.com:/Users/username $ bashrctest
-bash: bashrctest: command not found
username@usernames-mbp.raleigh.ibm.com:/Users/username $ bash
username@usernames-mbp.raleigh.ibm.com:/Users/username $ bashrctest
bashrc was read
username@usernames-mbp.raleigh.ibm.com:/Users/username $