Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Dec 11, 2012, 04:59 AM   #1
Let's Sekuhara!
macrumors 6502
 
Join Date: Jun 2008
Location: 日本
Quit Terminal without quitting process? / Multiple simultaneous Firefox profiles

Hi, I'd like to know how I can start a process via command line that is not a child of the app used to invoke the command.

For example if I open Terminal and enter:
Code:
/Applications/Firefox.app/Contents/MacOS/firefox -P "ProfileName"
It will run that Firefox profile, but only as long as I keep Terminal open.

Also tried creating an app bundle in AppleScript Editor, like so:
Code:
do shell script "/Applications/Firefox.app/Contents/MacOS/firefox -P \"ProfileName\""
This is less annoying, but still requires the launcher app to remain open alongside Firefox.

Any ideas?
__________________
27" i7 iMac | 11" MacBook Air | Black MacBook | iPhone 5
Favorite Mac apps: Blender | Ableton Live | Reason

Last edited by Let's Sekuhara!; Dec 14, 2012 at 11:07 AM. Reason: Changed thread title
Let's Sekuhara! is offline   0 Reply With Quote
Old Dec 11, 2012, 05:54 AM   #2
toptan
macrumors newbie
 
Join Date: Sep 2010
Location: Novi Sad, Serbia
I use nohup for stuff like that.

Code:
nohup /Applications/Firefox.app/Contents/MacOS/firefox -P "ProfileName"
The annoying thing is that you have to close terminal manually.
toptan is offline   0 Reply With Quote
Old Dec 11, 2012, 06:17 AM   #3
Let's Sekuhara!
Thread Starter
macrumors 6502
 
Join Date: Jun 2008
Location: 日本
Quote:
Originally Posted by toptan View Post
I use nohup for stuff like that.

Code:
nohup /Applications/Firefox.app/Contents/MacOS/firefox -P "ProfileName"
The annoying thing is that you have to close terminal manually.
Thank you!

I'm looking into whether I can (if I use the AppleScript approach) have the script quit itself after sending the shell script...
__________________
27" i7 iMac | 11" MacBook Air | Black MacBook | iPhone 5
Favorite Mac apps: Blender | Ableton Live | Reason
Let's Sekuhara! is offline   0 Reply With Quote
Old Dec 11, 2012, 06:31 AM   #4
Let's Sekuhara!
Thread Starter
macrumors 6502
 
Join Date: Jun 2008
Location: 日本
There is a command
Code:
tell me to quit
that is supposed to make the running AppleScript quit itself.
But I just tried writing it into my app and it doesn't work.
__________________
27" i7 iMac | 11" MacBook Air | Black MacBook | iPhone 5
Favorite Mac apps: Blender | Ableton Live | Reason
Let's Sekuhara! is offline   0 Reply With Quote
Old Dec 11, 2012, 11:36 AM   #5
talmy
macrumors 601
 
talmy's Avatar
 
Join Date: Oct 2009
Location: Oregon
Quote:
Originally Posted by toptan View Post
I use nohup for stuff like that.

Code:
nohup /Applications/Firefox.app/Contents/MacOS/firefox -P "ProfileName"
The annoying thing is that you have to close terminal manually.
You can also just put an ampersand (&) at the end of the line to run the process in the background. To close the terminal application you can execute killall Terminal assuming you have just one. Otherwise it's a fairly involved process -- get the process id of the bash shell, find it's parent process (a login process), and find the parent process of the login, which is the Terminal, which can then be killed.
__________________
27" i7 iMac, 15" MacBook Pro, Mac mini with Mavericks Server, 5 other Macs and an unused Apple TV.
talmy is offline   0 Reply With Quote
Old Dec 11, 2012, 04:52 PM   #6
Let's Sekuhara!
Thread Starter
macrumors 6502
 
Join Date: Jun 2008
Location: 日本
Quote:
Originally Posted by talmy View Post
You can also just put an ampersand (&) at the end of the line to run the process in the background. To close the terminal application you can execute killall Terminal assuming you have just one. Otherwise it's a fairly involved process -- get the process id of the bash shell, find it's parent process (a login process), and find the parent process of the login, which is the Terminal, which can then be killed.
If I want the process to run the same as a regular instance of Firefox (a process under my user, I suppose) then what would I type?
__________________
27" i7 iMac | 11" MacBook Air | Black MacBook | iPhone 5
Favorite Mac apps: Blender | Ableton Live | Reason
Let's Sekuhara! is offline   0 Reply With Quote
Old Dec 11, 2012, 06:57 PM   #7
talmy
macrumors 601
 
talmy's Avatar
 
Join Date: Oct 2009
Location: Oregon
Well I just realized that when you close the Terminal application it kills the login and the copy of Firefox goes away (hence the suggestion to use nohup).
However if you run Firefox from an xterm window (which doesn't do a login) or from an Automator Shell Script then using & works fine and the bash shell can exit with no problems.

Also, you can run Firefox using the Open command: "open /Applications/Firefox.app &"
__________________
27" i7 iMac, 15" MacBook Pro, Mac mini with Mavericks Server, 5 other Macs and an unused Apple TV.
talmy is offline   0 Reply With Quote
Old Dec 11, 2012, 11:13 PM   #8
Let's Sekuhara!
Thread Starter
macrumors 6502
 
Join Date: Jun 2008
Location: 日本
Quote:
Originally Posted by talmy View Post
However if you run Firefox from an xterm window (which doesn't do a login) or from an Automator Shell Script then using & works fine and the bash shell can exit with no problems.
Problem is, then the Automator script app has to remain open for the duration of the session. And that's almost equally annoying as having to keep Terminal open.
__________________
27" i7 iMac | 11" MacBook Air | Black MacBook | iPhone 5
Favorite Mac apps: Blender | Ableton Live | Reason
Let's Sekuhara! is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Resolved: Terminal cannot force quit Chrome bobfitz14 Mac Applications and Mac App Store 1 Apr 30, 2014 05:07 PM
Cannot Force Quit WebEx process (nor can I find it) Praxis91 Mac Basics and Help 7 Apr 28, 2014 01:00 PM
One mini, multiple simultaneous users... Oujmik Mac mini 20 Oct 31, 2013 07:41 AM
Terminal command for quitting applications? RedCroissant Mac Basics and Help 10 Feb 12, 2013 02:24 PM
Quitting the partitioning process forcefully + Missing Space ?! transblack MacBook Pro 1 Sep 1, 2012 05:10 PM

Forum Jump

All times are GMT -5. The time now is 11:39 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC