Enabling/Disabling Launch Agents via Terminal

This is probably a great April Fools joke to play on somebody,

but I need an expert opinion on how badly I've just screwed my Mac.


I wanted to disable my notification center, so I hopped into Terminal. I thought, I'll just disable com.apple.notificationcenterui.plist!

Thus, I told to my Terminal,

launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist


All was going well, until I hit up to reload my last command, backspaced to disable another agent, but then accidentally hit enter:

launchctl unload -w /System/Library/LaunchAgents/

Ooooooooops.


Terminal crashed, my desktop went black and all icons disappeared, the dock disappeared, and I was left with a solitary open Chrome browser window, and the top navigation bar. Clicking just about anything did nothing.


There was no finder. Downloading a file and clicking "Open in Finder" did nothing. I found that I could open the "downloads" folder in Chrome to view files, then click "Open location" and navigate through Chrome. Launching Terminal did nothing. I never did update to El Capitan, so I downloaded it through Chrome thinking if I installed the update I'd get my launch agents back. But, clicking to run any .dmg file did nothing.


So I turned the machine off, rebooted with command+R and launched Terminal that way. I figured I could just reload my launch agents with the reverse command:


launchctl load -w /System/Library/LaunchAgents/


But this is what I got back instead. "Service cannot load in requested session" for many agents. However, after rebooting the machine after this command, my desktop is back, my dock is back, and everything appears to be functioning correctly... Are there further steps I need to take to re-enable these other agents, or are they fine?


Nicholass-MacBook-Pro:~ NChimonas$ launchctl load -w /System/Library/LaunchAgents

/System/Library/LaunchAgents/com.apple.cvmsCompAgentLegacy_i386.plist: Service cannot load in requested session

/System/Library/LaunchAgents/com.apple.mdworker.lsb.plist: Service cannot load in requested session

/System/Library/LaunchAgents/com.apple.sbd.plist: Service cannot load in requested session

/System/Library/LaunchAgents/com.apple.secinitd.plist: Service cannot load in requested session

/System/Library/LaunchAgents/com.apple.security.cloudkeychainproxy.plist: Service cannot load in requested session

/System/Library/LaunchAgents/com.apple.speech.speechsynthesisd.plist: Service cannot load in requested session

/System/Library/LaunchAgents/com.apple.syncdefaultsd.plist: Service cannot load in requested session

/System/Library/LaunchAgents/com.apple.cvmsCompAgent_i386.plist: Service cannot load in requested session

/System/Library/LaunchAgents/com.apple.cvmsCompAgent_x86_64_1.plist: Service cannot load in requested session

/System/Library/LaunchAgents/com.apple.cvmsCompAgentLegacy_x86_64_1.plist: Service cannot load in requested session

/System/Library/LaunchAgents/com.apple.mbloginhelper.user.plist: Service cannot load in requested session

/System/Library/LaunchAgents/com.apple.pluginkit.pkd.plist: File exists

/System/Library/LaunchAgents/com.apple.secd.plist: Service cannot load in requested session

/System/Library/LaunchAgents/com.apple.cvmsCompAgent_x86_64.plist: Service cannot load in requested session

/System/Library/LaunchAgents/com.apple.distnoted.xpc.agent.plist: Service cannot load in requested session

/System/Library/LaunchAgents/com.apple.FileSyncAgent.PHD.plist: Service cannot load in requested session

/System/Library/LaunchAgents/com.apple.mdworker.shared.plist: Service cannot load in requested session

/System/Library/LaunchAgents/com.apple.metadata.mdflagwriter.plist: Service cannot load in requested session

/System/Library/LaunchAgents/com.apple.UserNotificationCenterAgent-LoginWindow.p list: Service cannot load in requested session

/System/Library/LaunchAgents/com.apple.mdworker.32bit.plist: Service cannot load in requested session

/System/Library/LaunchAgents/com.apple.cfprefsd.xpc.agent.plist: Service cannot load in requested session

/System/Library/LaunchAgents/com.apple.cvmsCompAgent_i386_1.plist: Service cannot load in requested session

/System/Library/LaunchAgents/com.apple.cvmsCompAgentLegacy_x86_64.plist: Service cannot load in requested session

/System/Library/LaunchAgents/com.apple.mdworker.mail.plist: Service cannot load in requested session

/System/Library/LaunchAgents/com.apple.mdworker.single.plist: Service cannot load in requested session

/System/Library/LaunchAgents/com.apple.TrustEvaluationAgent.plist: Service cannot load in requested session

/System/Library/LaunchAgents/com.apple.UserEventAgent-LoginWindow.plist: Service cannot load in requested session

/System/Library/LaunchAgents/com.apple.mdworker.bundles.plist: Service cannot load in requested session

/System/Library/LaunchAgents/com.apple.mdworker.sizing.plist: Service cannot load in requested session

/System/Library/LaunchAgents/com.apple.netauth.user.auth.plist: Service cannot load in requested session

/System/Library/LaunchAgents/com.apple.xmigrationhelper.user.plist: Service cannot load in requested session

/System/Library/LaunchAgents/com.apple.AppleGraphicsWarning.plist: Service cannot load in requested session

/System/Library/LaunchAgents/com.apple.cvmsCompAgentLegacy_i386_1.plist: Service cannot load in requested session

/System/Library/LaunchAgents/com.apple.mbpluginhost.user.plist: File exists

/System/Library/LaunchAgents/com.apple.mdworker.isolation.plist: Service cannot load in requested session

/System/Library/LaunchAgents/com.apple.tccd.plist: Service cannot load in requested session

Nicholass-MacBook-Pro:~ NChimonas$ launchctl load -w /System/Library/LaunchAgents

[Restored]

Last login: Fri Apr 1 14:14:39 on console

MacBook Pro (Retina, 15-inch, Mid 2014), OS X Yosemite (10.10.5), Terminal Fun!

Posted on Apr 1, 2016 1:31 PM

Reply
2 replies

Apr 1, 2016 1:42 PM in response to CosmicRhino

The solution is called "Reinstall OS X."


Reinstall OS X Without Erasing the Drive


  1. Restart the computer and after the chime press and hold down the COMMAND and R keys until the Utility Menu appears.
  2. Choose Disk Utility from the Utility Menu and click on the Continue button. Repair the Hard Drive and Permissions as follows.
  3. After Disk Utility loads select the indented (usually, Macintosh HD) entry from the the side list. Click on the First Aid tab, then click on the Repair Disk button. If Disk Utility reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported click on the Repair Permissions button.
  4. When the process finishes, quit Disk Utility and return to the Utility Menu.
  5. Select Reinstall OS X and click on the Continue button.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Enabling/Disabling Launch Agents via Terminal

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.