Skip to main content
added 76 characters in body
Source Link
nohillside
  • 108.3k
  • 43
  • 230
  • 291

This has worked for me in the past:

Log out (with confirmation)

osascript -e 'tell app "System Events" to log out' 

Log out directly (no confirmation)

osascript -e 'tell app "System Events" to «event aevtrlgo»' 

or

osascript -e 'tell application "loginwindow" to «event aevtrlgo»' 

This way any running application will get noticed and can terminate in a safe fashion.

This has worked for me in the past:

Log out (with confirmation)

osascript -e 'tell app "System Events" to log out' 

Log out directly (no confirmation)

osascript -e 'tell app "System Events" to «event aevtrlgo»' 

This way any running application will get noticed and can terminate in a safe fashion.

This has worked for me in the past:

Log out (with confirmation)

osascript -e 'tell app "System Events" to log out' 

Log out directly (no confirmation)

osascript -e 'tell app "System Events" to «event aevtrlgo»' 

or

osascript -e 'tell application "loginwindow" to «event aevtrlgo»' 

This way any running application will get noticed and can terminate in a safe fashion.

Source Link
nohillside
  • 108.3k
  • 43
  • 230
  • 291

This has worked for me in the past:

Log out (with confirmation)

osascript -e 'tell app "System Events" to log out' 

Log out directly (no confirmation)

osascript -e 'tell app "System Events" to «event aevtrlgo»' 

This way any running application will get noticed and can terminate in a safe fashion.