Making ~/.bashrc function callable to set up an environment I have an installed app lets call it my_app that I wish to be able to call from the command line. It is located in /Applications/my_app.app/Contents/Resources.

So what I was hoping to do was to have my ~/.bashrc look like the following: 

# .bashrc

my_app-start(){
export PATH=$PATH:/Applications/my_app.app/Contents/Resources/
}


and then every time I want to be able to use the app from a new terminal session I would load call my_app-start after which I expect my app to be callable by simply typing my_app anywhere on my system. However my terminal does not recognise the my_app-start function... On another linux platform this works for me but perhaps Macs need some fiddling with ~/.bash_profile. I never understood the difference. 


How do I make the function automatically callable?
Is this method a safe, sensible way of loading my application?
Your function doesn't work because OS X starts your shell as a login shell, thus .bashrc isn't read. I wouldn't use a function in this case.
If there is only one executable file in /Applications/my_app.app/Contents/Resources/ then I would use an alias.

I would use separate files when changing your environment. Set your PATH and whatever in these/this file(s) then at any time source your environment file and your good to go. As an example, I have the AST tool set installed. I'm testing the tools supplied by AST but need to use the minimum PATH supplied by OS X and the PATH to the AST tools. So, I have to modify my PATH that is set in my .profile. I've created a file .astenv in my home folder.

#
#  .astenv
#
#  The AT&amp;T Software Technology tools from AT&amp;T Research
#
#

PATH=$(/usr/bin/getconf PATH)
ASTPATH=$HOME/local/opt/ast-master/arch/darwin/bin

PATH=$ASTPATH:$PATH
export PATH


To use this config file,  I can start a new terminal session and source the file,

. ~/.astenv


or in my current terminal session start a new instance of my shell then source the file.

ksh
. ~/.astenv


When I exit this shell, I'm back to my original environment.