In .profile, why is alias not working?

Recently (since upgrading to Mavericks??), several alias commands in ~/.profile are not working after I start Terminal (although numerous path settings set up there are working as expected). For example, ~/.profile includes:


alias mysqlctl='sudo /usr/local/mysql/support-files/mysql.server'

alias mysqlstart='mysqlctl start'


But after I start Terminal and execute


mysqlstart


I get error:

bash: mysqlstart: command not found


I know that something peculiar is going on because when I attempt to exit the (one and only) running Terminal session with command exit I just see an echoed response


exit


but can quit Terminal by executing the same exit command again.


Moreover, if in Terminal I execute


source ~/.profile


then the aliases work as expected.


I did try the ruse I found somwhere of including before any of the other alias lines in .profile the command alias sudo='sudo ' but that doesn't fix the problem.


I thought perhaps some other startup file is being read and hence commands in ~/.profile are therefore not being executed, but I find no such: I have no

~/.bashrc or ~/.bash_profile or ~/.login file. (And Terminal is set to use the default login shell, which is bash.


What could be wrong and how can it be fixed?

iMac, OS X Mavericks (10.9), 3.4GHz Corei7, 16GB, SSD + 2T HD

Posted on Feb 8, 2014 9:41 PM

Reply
18 replies

Feb 9, 2014 11:07 AM in response to Frank Caggiano

Frank Caggiano wrote:


Look in the Preferences for the Terminal


If I have Startup: Run command set to bash I get the same exact symptoms you are getting

Removing that Preferences setting fixed things -- with all my settings in ~/.profile and no ~/.bash_profile or ~/.bashrc file at all.


The remaining mystery is how that preference got changed: I didn't manually change it.


Suppose I do want to go ahead, as others have recommended, and move the actual settings out of ~/.profile and into ~/.bashrc, with ~/.bashrc being sourced by ~/.bash_profile. What Terminal setting should I use then? Note that I already have the Terminal preferences Startup tab with: Shells open with Default login shell.

Feb 9, 2014 11:14 AM in response to murrayE

You don;t need anything there (or any of the other preferences) really.


They are there to make doing any extra initialization easier. Or overriding the login shell if you don;t have access to the system preferences. Anything else the preferences do can be done from the rc files.


I only use the preferences for the look of the terminal, color, font etc.


regards

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

In .profile, why is alias not working?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.