4

After following thiscomment I added all my startup/alias commands to~/.bashrc file and in~/.bash_profile I addedsource ~/.bashrc

But still my aliases are not working. I have to manually source~/.bash_profile overtime (withsource ~/.bash_profile).

My .bashrc file:

alias km='cd /Users/apple/Desktop/km'

and my .bash_profile file

if which rbenv > /dev/null; then eval "$(rbenv init -)"; fisource ~/.bashrc

In my user directory I only have following files:enter image description here

My iterm2 profile:enter image description here

UPDATE:For me this solution actuallyworked

askedDec 29, 2015 at 9:34
Niraj Chauhan's user avatar
7
  • is your terminal configured to launch alogin shell?CommentedDec 29, 2015 at 18:15
  • Yes I guess its using login shell. Please check screenshot attached aboveCommentedDec 30, 2015 at 4:57
  • Try running Terminal, the built in one not iTerm. Does it load your alias?CommentedDec 30, 2015 at 10:00
  • no it didnt work :(CommentedDec 30, 2015 at 11:13
  • If you solved your problem, please post an answer and accept it. Make sure you include proper acknowledgement of the original author, a link, and the most important information from said post. This helps future users by allowing them to easily see that the problem is solved even if they miss the last line.CommentedJan 2, 2016 at 7:50

2 Answers2

0

So after all struggle the only solution which worked for me is by executingsource ~/.bashrc every time when I open my terminal.

answeredJan 2, 2016 at 8:26
Niraj Chauhan's user avatar
0

I've gotten it to work by using .login and .profile.The way it works is .login is sourced by every login shell and it in turn sources .profile

In .login I have:

. .profile

and in .profile I have:

function pgrep(){ps -axww | grep -i "$1" | grep -v "[p ]grep"}function diskspc(){sudo find / -iname "*$1*" -print0 | xargs -0 du -chs}JAVA_HOME="/System/Library/Frameworks/JavaVM.Framework/Versions/1.5.0/Home"export JAVA_HOMEalias rsync="rsync --stats --progress"alias forcequit="open -a iForce\ Quit"alias ls="/bin/ls -FG"alias ll="ls -la"alias gls="gls --color=auto -aF"alias find="/usr/bin/find". /sw/bin/init.shLC_ALL='C'export LC_ALLalias locate2='if [ $((`date +%s`-`eval $(stat -s /var/db/locate.database); echo $st_mtime`)) -gt 3600 ]; then echo "locate: db is too old!">/dev/stderr; sudo /usr/libexec/locate.updatedb; fi; locate -i'alias flocate="/sw/bin/locate.fink --database=/sw/var/locatedb"LOCATE_PATH=/var/db/locate.database#LOCATE_PATH=/sw/var/locatedb:/var/db/locate.database#LOCATE_PATH=/sw/var/locatedbexport LOCATE_PATH#LESS_IS_MORE=1#export LESS_IS_MORE

Of course,feel free to use or not the stuff in my .profile.

answeredJan 5, 2016 at 6:30
David Fass's user avatar

You mustlog in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.