{"id":318727,"date":"2021-08-08T21:00:00","date_gmt":"2021-08-08T18:00:00","guid":{"rendered":"https:\/\/en.buradabiliyorum.com\/how-to-log-out-of-your-mac-using-terminal\/"},"modified":"2021-08-08T21:00:00","modified_gmt":"2021-08-08T18:00:00","slug":"how-to-log-out-of-your-mac-using-terminal","status":"publish","type":"post","link":"https:\/\/buradabiliyorum.com\/en\/how-to-log-out-of-your-mac-using-terminal\/","title":{"rendered":"#How to Log Out of Your Mac Using Terminal"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_85 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a30169bb376f\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #dd3333;color:#dd3333\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #dd3333;color:#dd3333\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a30169bb376f\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-log-out-of-your-mac-using-terminal\/#Terminate_the_loginwindow_Process\" >Terminate the loginwindow Process<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-log-out-of-your-mac-using-terminal\/#Use_a_launchctl_Command\" >Use a launchctl Command<\/a><\/li><\/ul><\/nav><\/div>\n<p><strong>&#8220;#How to Log Out of Your Mac Using Terminal&#8221;<\/strong><\/p>\n<div>\n<img loading=\"lazy\" decoding=\"async\" class=\"type:primaryImage alignnone size-full wp-image-738265 \" srcset=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/06\/Terminal-hero.png?width=398&amp;trim=1,1&amp;bg-color=000&amp;pad=1,1 400w, https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/06\/Terminal-hero.png?width=1198&amp;trim=1,1&amp;bg-color=000&amp;pad=1,1 1200w\" sizes=\"auto, 400w, 1200w\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/06\/Terminal-hero.png?width=1198&amp;trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"\" width=\"1200\" height=\"675\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p><a href=\"https:\/\/buradabiliyorum.com\/en\/category\/download-scripts-themes-apps\/\" data-internallinksmanager029f6b8e52c=\"9\" title=\"Download Scripts &amp; Themes &amp; Apps\" target=\"_blank\" rel=\"noopener\">App<\/a>le makes it easy to log out of your Mac with the option in the desktop\u2019s menu bar. But there are also a couple of commands you can use to log out using Terminal, as we\u2019ll discover today.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Terminate_the_loginwindow_Process\"><\/span><a rel=\"nofollow noopener\" target=\"_blank\" name=\"moka_anchor_TerminateLoginWindowProcess\">Terminate the loginwindow Process<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>One way of logging out of your user account is by running a command to terminate <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/flylib.com\/books\/en\/2.673.1.128\/1\/\">the loginwindow process<\/a>. To get started, you\u2019ll need to\u00a0open Terminal. You can quickly do this using Spotlight Search.<\/p>\n<p>Click the magnifying glass icon to the right of the desktop\u2019s menu bar (or press Command+Space) to launch Spotlight Search.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-738247\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/06\/Click-the-magnifying-glass-icon-in-the-menu-bar..png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"\" width=\"540\" height=\"237\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>The Spotlight Search bar will appear. Type \u201cTerminal,\u201d and then press the Return key or click \u201cTerminal\u201d in the search results.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-738248\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/06\/Search-for-Terminal-in-Spotlight-Search-and-press-Return..png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Search for &quot;Terminal&quot; in Spotlight Search and press &quot;Return.&quot;\" width=\"441\" height=\"340\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Terminal will launch. Now, run this command:<\/p>\n<pre>sudo pkill loginwindow<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-738249\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/06\/Run-the-sudo-pkill-loginwindow-command..png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Run the &quot;sudo pkill loginwindow&quot; command.\" width=\"626\" height=\"200\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Next, enter your account password and press the Return key.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-738250\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/06\/Enter-your-account-password..png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Enter your account password.\" width=\"625\" height=\"201\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>This will terminate the loginwindow process, successfully logging you out of your user account.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Use_a_launchctl_Command\"><\/span>Use a launchctl Command<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>launchctl commands are a set of commands that control <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/www.howtogeek.com\/319048\/what-is-launchd-and-why-is-it-running-on-my-mac\/\">the launchd process. You can find a list of launchctl commands by running <code>launchctl help<\/code>\u00a0in Terminal, but we want to use the one that logs you out of your user account.<\/p>\n<p>Before we start typing commands, you\u2019ll need to know your user ID. To find it, open Spotlight Search (click the magnifying glass icon in the desktop\u2019s menu bar or press Command+Space) and type \u201cUsers &amp; Groups\u201d in the search bar. Press the Return key or click \u201cUsers &amp; Groups\u201d in the search results.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-738253\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/06\/Search-and-open-Users-and-Groups-from-Spotlight-Search..png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Search and open &quot;Users and Groups&quot; from Spotlight Search.\" width=\"497\" height=\"306\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Click the padlock in the bottom-left corner of the window that appears.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-738258\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/06\/Click-the-lock..png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Click the lock.\" width=\"533\" height=\"301\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Now, enter your account password and click \u201cUnlock.\u201d<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-738257\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/06\/Enter-your-password-and-click-Unlock..png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Enter your password and click Unlock.\" width=\"544\" height=\"261\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Next, right-click your account in the \u201cCurrent User\u201d group in the left-hand pane, and then click \u201cAdvanced Options.\u201d<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-738254\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/06\/Right-click-your-user-name-and-then-click-Advanced-Options..png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Right-click your user name and then click &quot;Advanced Options.&quot;\" width=\"534\" height=\"359\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Finally, take a note of your user ID. You\u2019ll need this for the command.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-738255\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/06\/Find-your-user-ID..png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Find your user ID.\" width=\"540\" height=\"240\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>With user ID in hand, open Terminal (use Spotlight Search to search for \u201cTerminal\u201d to open the app). In Terminal, run the following command (replacing <code>&lt;user id&gt;<\/code>\u00a0with your ID noted earlier):<\/p>\n<pre>launchctl bootout user\/$(id -u &lt;user id&gt;)<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-738251\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/06\/Run-the-launchctl-bootout-user-command..png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Run the launchctl bootout user command.\" width=\"627\" height=\"198\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>You\u2019ll now be logged out of your user account.<\/p>\n<p>This is just one of the many things that you can do with Mac\u2019s Terminal. You can also do things like lock your Mac\u00a0or even shut it down. Keep learning these basic commands and you\u2019ll be a hacker in no time!<\/p>\n<p><strong>RELATED:<\/strong> <strong><em>The Best &#8220;Just For Fun&#8221; Tricks Hidden in macOS&#8217; Terminal<\/em><\/strong><\/p>\n<\/div>\n<p><script>\n setTimeout(function(){\n  !function(f,b,e,v,n,t,s)\n  {if(f.fbq)return;n=f.fbq=function(){n.callMethod?\n  n.callMethod.apply(n,arguments):n.queue.push(arguments)};\n  if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';\n  n.queue=[];t=b.createElement(e);t.async=!0;\n  t.src=v;s=b.getElementsByTagName(e)[0];\n  s.parentNode.insertBefore(t,s) } (window, document,'script',\n  'https:\/\/connect.facebook.net\/en_US\/fbevents.js');\n   fbq('init', '335401813750447');\n   fbq('track', 'PageView');\n  },3000);\n<\/script><\/p>\n<blockquote><p><strong><span style=\"color: #ff6600;\">If you liked the article, do not forget to share it with your friends. Follow us on\u00a0<span style=\"color: #ff0000;\"><a style=\"color: #ff0000;\" href=\"https:\/\/news.google.com\/publications\/CAAqBwgKMLG0nwswvr63Aw\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Google News<\/a><\/span>\u00a0too, click on the star and choose us from your favorites.<\/span><\/strong><\/p><\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\">For forums sites go to <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/forum.buradabiliyorum.com\/\" target=\"_blank\" rel=\"noopener\">Forum.BuradaBiliyorum.Com<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\"><strong>If you want to read more like this article, you can visit our <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/en.buradabiliyorum.com\/technology\/\" target=\"_blank\" rel=\"noopener\">Technology category.<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<p><span style=\"color: black;\"><a style=\"color: #ff9900;\" href=\"https:\/\/www.howtogeek.com\/736228\/how-to-log-out-of-your-user-account-using-terminal-on-mac\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;#How to Log Out of Your Mac Using Terminal&#8221; Apple makes it easy to log out of your Mac with the option in the desktop\u2019s menu bar. But there are also a couple of commands you can use to log out using Terminal, as we\u2019ll discover today. Terminate the loginwindow Process One way of logging&#8230;<\/p>\n","protected":false},"author":1,"featured_media":318728,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/06\/Terminal-hero.png?height=200p&trim=2,2,2,2","fifu_image_alt":"","footnotes":""},"categories":[18],"tags":[],"class_list":["post-318727","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/318727","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/comments?post=318727"}],"version-history":[{"count":0,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/318727\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media\/318728"}],"wp:attachment":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media?parent=318727"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/categories?post=318727"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/tags?post=318727"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}