4

After following this comment I added all my startup/alias commands to ~/.bashrc file and in ~/.bash_profile I added source ~/.bashrc

But still my aliases are not working. I have to manually source ~/.bash_profile overtime (with source ~/.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 -)"; fi
source ~/.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 actually worked

  • is your terminal configured to launch a login shell? – glenn jackman Dec 29 '15 at 18:15
  • Yes I guess its using login shell. Please check screenshot attached above – Niraj Chauhan Dec 30 '15 at 4:57
  • Try running Terminal, the built in one not iTerm. Does it load your alias? – Arc676 Dec 30 '15 at 10:00
  • no it didnt work :( – Niraj Chauhan Dec 30 '15 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. – Arc676 Jan 2 '16 at 7:50
0

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

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_HOME

alias 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.sh

LC_ALL='C'
export LC_ALL

alias 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/locatedb
export LOCATE_PATH

#LESS_IS_MORE=1
#export LESS_IS_MORE

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .