How JustAnswer Works:
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site. Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.
Ask James Your Own Question
James, Sr. Mac Support Expert
Category: Mac
Satisfied Customers: 15908
Experience:  Mac Expert
Type Your Mac Question Here...
James is online now
A new question is answered every 9 seconds

Hi folks --- Im a newcomer on the Forum, with the following

This answer was rated:

Hi folks --- I'm a newcomer on the Forum, with the following question :

I know how to open an application window on my Mac remotely from another iOS device (such as my iPad), by connecting with an SSH session and using the UNIX "open" command. For example, I can open the iTunes window on the Mac with
open -a

What I'm looking for is the opposite of this "open" command. That is, how do you *close* the window remotely on the Mac (i.e., from my iOS device) once it has been opened ?

Thanks for your help!
The only way to remotely close an application is to "kill" it.
You can use:

killall itunes

This will close itunes.


Customer: replied 5 years ago.
Thank you for your very quick reply!

Re your answer --- I want to make sure that just the iTunes *window* closes on the Mac, not the application itself (which I think always runs in the background, right?).

It should be just as if I clicked "Quit iTunes" on my Mac desktop.

Will the kill command do this?
It will kill any program called "itunes" - the other apps that run in the background have different names (like bonjour). It will not kill them. It only kills the app that matches the name you specify for the killall command.

Glad I could help!

Customer: replied 5 years ago.
Yes, I know that. I think you answered my question but I'm not sure.

Note that if I check the processes running on the Mac using the UNIX "ps" command, I see there is something called "iTunesHelper" running all the time. But when the iTunes window appears on my Mac screen, this goes away and the "iTunes" app appears as the running process.

I think this means you are right in that the "killall" command should remove iTunes from the screen and not affect anything else. (In other words, the killall command has exactly the same effect as clicking "Quit iTunes" on the Mac screen, right?)
That's correct.
By the way, if you do PS and see the running processes, you can kill an application by the process number.

kill -9 NUMBER

Where number is XXXXX process number you wish to kill.

Either method will work.

James and 2 other Mac Specialists are ready to help you