Problem:
I want to be able to run a bash instance from my cocoa application (OS X) with all the normal profiles loaded (~/.bash_profile, etc). I don’t want to load the profiles manually since I want to have a default bash instance that is exactly the same as one you would get by firing terminal. From there, I’d like to retrieve some pre-defined environment variable (Ruby version manager’s variables).
What I’ve tried:
I’ve already tried some solutions with no success. Let me list them here:
- NSTask
- system() call
for every solutions I tried to execute “/bin/sh -l” to have a bash instance loaded as the current username… unfortunately it didn’t work.
When you run
bashassh, it runs in a compatibility mode where it doesn’t read.bash_profile. If you want to runbashthen run/bin/bash(or if you want other people to use your application, make sure you account for whatever shell the user has selected.)