Ssh Reboot Mac

I hate typing in passwords. Everyone hates typing in passwords. When dealing with remote computers there are many many passwords to type in, and that's why we have SSH with keys. To quit, it's best just to do a 'sudo reboot' otherwise things get confusing, though you can ctrl-c the. Re: X windows session over ssh on Mac/Linux.

Possibly recover from a freeze without a reboot 25 comments Create New Account
Click here to return to the 'Possibly recover from a freeze without a reboot' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.

Here's another somewhat related tip for users of LaunchBar and possibly/probably QS as well. A couple of times OS X has locked up on me with the system menu and dock not responding. I clearly needed to restart or shut down to fix the problem, but I didn't want to do a hard shutdown (holding down the power key). What I found was that hitting command-space on my keyboard still activated LaunchBar, and from there I was able to launch Activity Monitor. Then, I quit the loginwindow process which took me back to the login window. From there I could then log back in or (for safety) do a proper restart.

And for book owners (I've had ocasional problems with interface freeze), if you get the 'dreaded freeze,' try closing the lid and wait a minute or so for the sleep light to come on. Then open back up, and most times the macine will wake up and be responsive again. If the sleep light doesn't come on within about 3 minutes, then I'll just reboot, but often this works for me.
windrag 700MHz iBook 16 VRAM G3 Seagate 80MB HD 640MB RAM OS X 10.4.4

Why I had to Log In to view this hint? Is it somehow special?

Why the members only article?
I had to register to read this.
Not cool guys. Not cool.

A temporary bug in the database, perhaps? I read it just fine, and only just now had to login in order to post this comment.

Yeah, maybe. At that time - when I've posted my comment - the article wasn't even visible for Users which where not logged in (I stumbled across the article because of the RSS-Feed, but wasn't able to read it, I had to log in).
Now everything seems back to normal. I hope this wasn't just a test for 'enhancements' or something.?

This sort of this has happened to me a few times, thankfully its very infrequent. I log in to the locked up machine via another of my Macs using ssh (enabled on all my Macs via System Preferences -> Sharing -> Services, the check 'Remote Login').
From the command line on the remote Mac, I ssh into the 'frozen' Mac and force it to shutdown via the 'sudo shutdown -r now' command. This nearly always worked; I've only had to use the power button to restart my G5 once or twice.

Why would shutdown -r from a remote machine be preferable to rebooting with the power key?

Because it would be a 'safe' restart instead of a 'hard' restart (holding power button).

Good question. From the man pages for shutdown(8):

The shutdown utility provides an automated shutdown procedure for super-users to nicely notify users when the system is shutting down, saving them from system administrators, hackers, and gurus, who would otherwise not bother with such niceties.

It doesn't mention anything about cleanly shutting down. But if you look at the man pages for reboot(8), it's a little more clear:

The halt and reboot utilities flush the file system cache to disk, send all running processes a SIGTERM (and subsequently a SIGKILL) and, respectively, halt or restart the system. The action is logged, including entering a shutdown record into the wtmp(5) file.

Normally, the shutdown(8) utility is used when the system needs to be halted or restarted, giving users advance warning of their impending doom and cleanly terminating specific programs.

Whether or not this informs the WindowServer process, isn't directly alluded to. But I'm sure it gets the message.

I have used ssh to get into a frozen mac but often you do not have to do a reboot. If you run the unix command 'top' you can see which applications are running. If one is causing the freeze-up it will often show a huge cpu usage. Killing that process will often free up the computer. Here are the commands:

Ssh Reboot Mac

  1. Remote Login must already be enabled on the Mac. Just leave it on all the time, it is useful and secure.
  2. From another machine (Mac, Linux, Windows.. they can all do this):
    ssh [email protected]
    root is whatever username you use and the ip address is whatever your machine is actually on.
  3. top -o cpu
    this will list everything running on the machine in order of cpu usage. Note the PID (Process ID) number on the far left.
  4. kill -9 2294
    where 2294 is the actual PID of the thing you want to stop. kill stops a process and -9 simply means 'no excuses.. kill it no matter what'.
If that doesn't free up your machine you could try killing the Finder (get it's PID using top.. it should restart on it's own) and if THAT doesn't do it then do the reboot.
Most people won't need to get the pid's, but can just use killall. For example to kill the Finder, do This could cause trouble on a multi user machine, so be careful if other people are logged in. On the other hand if your desktop is frozen, odds are all other processes are frozen too..

This is quite possibly the weakest hint I have ever seen on Mac OS X Hints.
I was expecting something beyond a basic user skill level.

You could also do Control-Eject, then hit 's'. That shuts down (I think), 'r' reboots, and Enter sleeps.

Plex brings together all the media that matters to you. Your personal collection will look beautiful alongside stellar streaming content. Enjoy Live TV & DVR, a growing catalog of great web shows, news, and podcasts. It's finally possible to enjoy all the media you love in a single app, on any device, no matter where you are. Infuse has promise, but it scrapes GDrive unbearably slow. I’ve had it spend three hours and it only found metadata for a dozen films. It outperforms Plex when it comes to playback–especially streaming from GDrive. This is to be expected, though, as Infuse does not rely on a device’s built-in player. Plex is awesome for metadata and library ha fling especially in multi device households. That being said the plex player portion is an absolute turd. Probably the best way to go is a hybrid solution with plex server as the backend and infuse as the player. Plex infuse. Infuse and Plex clients are full-featured media players. Infuse converts any media not natively supported by Apple on the client machine. Plex uses the muscle of the server to do this. With Plex, it's possible to have multiple copies of a movie grouped together under a single item. Infuse will display these items as a single item, and prompt you to select a version to play when playing a title for the first time. Infuse will remember your selection when playing the same title on the same device.

These keyboard shortcuts are not quite right. Ctrl+Eject+Enter shuts down. I don't know about the other shortcuts.

CajunLuke, I'm glad you mentioned that CTRL-Eject, then s, can shut down the Mac. I see that CTRL-Eject brings up the 'Restart Sleep Cancel Shutdown' dialog box on my Mac, even though I use a MS Natural Multimedia Wireless keyboard that lacks a dedicated Eject key. CTRL-[the key I assigned to be the Eject key] works for me, though, and now that I know it, that frees up one of the other keys. I can assign it to something else! Thanks!

This is interesting because I always have trouble moving my powerbook which is sleeping to the office where I plug in a USB keyboard. Many times the act of plugging in the USB keyboard (done while its asleep) will cause it to wake up. Then the keyboard doesn't work.
My reason for doing this is I want to keep the lid closed and use and external monitor as well. I've actually found it easier to simply shutdown and restart when I'm gonna move from home to office.

I sometimes get similar freezes- seemingly related to Safari.
I discovered, quite by accident, that pounding the 'Return' key a few times almost always fixes it.
sttaw sirhc

If you connect or disconnect a USB device from a sleeping Mac notebook with the power cable plugged in, it will wake up; if you unplug the power first, then the keyboard, it will stay asleep. It will however wake up again when you plug the power back in..

This has been happening to me a lot (multiple times a day). The keyboard and/or mouse just stop working. It'll happen while I'm using the computer or while the screen saver is up. The machine in question is a new 20' Intel iMac, less than a week old.
I can unplug the USB cable and plug it back in and everything starts working again. Not sure yet what's causing it, but it's been happening since day one. Very aggravating. Is it a hardware issue?
-Jim K.


I have a 17' intel iMac and I'm having the same problem. It too is only a week old. Very Frustrating!
I've just converted from the Dell camp, I have always thought of Macs as a superior product, I hope this isn't what I can expect from my Mac.

I'm sorry no one has responded to your question here guys. Do everyone a favor though, will you? If/when you figure out the problem, please come back here and post the solution? That way, this hint becomes a very helpful resource when the next guy experiences the same issue…
Thanks, and good luck. I hope it's not a widespread 'iMacIntel' problem!

Ssh Reboot Mac Desktop

My wife's 800MHz 15' flat panel has just started exhibiting similar problems. Keyboard and mouse just freeze. Clock and system monitor graphs in the finder bar still work fine and I can ssh in to reboot it.
I had no luck reseating the USB keyboard and mouse.
She's trying to remember if it started happening after 10.4.5 or before.
Yes, please post if anyone finds a solution. Hers is outside the Apple Care window and has been running fine for years.
Fix Permissions and extended hardware test are clean.

Reboot Machine Ssh

Ssh reset mac

Ever since that initial freeze, it started happening to me more and more. It eventually got to the point where unplugging and replugging the keyboard no longer helped. I'd tried different USB ports, but the same thing happened on all of them with the same frequency. I tried different keyboards (but the same macally icemouse). Here's the type of errors I was getting in my console:
Feb 3 14:26:53 MyComputer kernel: USBF: 4592991.182 AppleUSBOHCI[0x222a000]::MakeDevice error setting address. err=0xe00002ed device=0x378e100 - releasing device
I eventually isolated my problems to the mouse itself. I assume it was not responding properly to USB queries from the computer and was currupting USB communication. I'd been discussing the issue on an email forum at my workplace and another person who was having the same problem mentioned that his mouse and keyboard had been damaged by a static discharge. So that lead me to try swapping out the mouse. Ever since I replaced the mouse almost two weeks ago, I have not had it freeze up or lose power. (Note that whenever this happened, the light on my optical mouse would not come on - which I'd interpretted as a power loss.)
So I think this is all due to a dying/faulty USB peripheral. The problem with the USB driver is that it can't seem to keep the problem from affecting other peripherals (perhaps connected through a common hub, but I can't confirm this). Does anyone know a way to reset the USB driver so that unplugging/replugging is not necessary to temporarily recover from this situation until the peripheral can be replaced?

More than three years after originally posted, this tip really helped me out.
Infrequently, my computer will wake from sleep or a screen saver with a black screen. I can see and move the cursor but no login screen appears. I am able to log in remotely via ssh but nothing I ever tried (restarting Finder) ever brought back the login screen. I would end up surrendering with a 'sudo shutdown -r now'.
This tip did the trick. I pushed the button quickly, the machine went to sleep, I then unplugged and plugged in the keyboard, and when the machine woke, I had a login screen. Awesome.