<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel><title>macos | Hugo Ferreira</title>
    <link>https://hugo.ferreira.cc/tags/macos/</link>
    <description>Recent content in Macos by Hugo Ferreira</description>
    <image>
      <title>macos | Hugo Ferreira</title>
      <url>https://hugo.ferreira.cc/hf-bw.jpg</url>
      <link>https://hugo.ferreira.cc/tags/macos/</link>
    </image>
    <generator>Hugo -- 0.124.1</generator>
    <language>en</language>
    <copyright>2000–2024 by Hugo Ferreira · CC BY 4.0</copyright>
    <lastBuildDate>Tue, 01 Jan 2008 12:07:52 +0000</lastBuildDate>
    <atom:link href="https://hugo.ferreira.cc/tags/macos/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>✂️ Apple</title>
      <link>https://hugo.ferreira.cc/apple/</link>
      <pubDate>Tue, 01 Jan 2008 12:07:52 +0000</pubDate>
      <guid>https://hugo.ferreira.cc/apple/</guid>
      <description>Small information nuggets and recipies about Apple OS’s</description>
      <content:encoded><![CDATA[<p><em>(most recent on top)</em></p>
<h2 id="list-all-registered-url-schemes">List all registered url schemes</h2>
<ul>
<li><a href="https://apple.stackexchange.com/a/397188">applications - What are all of the URI Schemes Available on macOS - Ask Different</a></li>
</ul>
<pre tabindex="0"><code>/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump URLSchemeBinding
</code></pre><p>or, to make it more readily available:</p>
<pre tabindex="0"><code>alias lsregister=&#39;/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister&#39;
lsregister -dump URLSchemeBinding
</code></pre><h2 id="access-unicode-characters-for-keyboard-symbols">Access unicode characters for keyboard symbols</h2>
<ul>
<li>
<p><a href="https://apple.stackexchange.com/a/293486">keyboard - Where can I find the unicode symbols for Mac functional keys? (Command, Shift, etc.) - Ask Different</a></p>
<blockquote>
<p>You can click the ⚙️ or (•••) button &gt; <strong>Customize List</strong> and enable additional unicode characters groups, including <strong>Code Tables &gt; Unicode</strong> which will show the full unicode table grouped by categories.</p>
<p>The ⌘ ⇪⌥ ⏎ symbols are grouped under the <strong>Symbols &gt; Technical Symbols</strong> category which you can enable for quick access</p>
</blockquote>
</li>
<li>
<p>Interesting categories to enable:</p>
<ul>
<li>Symbols &gt; Musical Symbols</li>
<li>Symbols &gt; Signs and Standard Symbols</li>
<li>Symbols &gt; Technical Symbol</li>
</ul>
</li>
</ul>
<h2 id="link-to-notes">Link to Notes</h2>
<style type="text/css">
    .notice {
        --root-color: #444;
        --root-background: #eff;
        --title-color: #fff;
        --title-background: #7bd;
        --warning-title: #c33;
        --warning-content: #fee;
        --info-title: #fb7;
        --info-content: #fec;
        --note-title: #6be;
        --note-content: #e7f2fa;
        --tip-title: #5a5;
        --tip-content: #efe;
    }

    @media (prefers-color-scheme:dark) {
        .notice {
            --root-color: #ddd;
            --root-background: #eff;
            --title-color: #fff;
            --title-background: #7bd;
            --warning-title: #800;
            --warning-content: #400;
            --info-title: #a50;
            --info-content: #420;
            --note-title: #069;
            --note-content: #023;
            --tip-title: #363;
            --tip-content: #121;
        }
    }

    body.dark .notice, [data-theme="dark"] .notice {
        --root-color: #ddd;
        --root-background: #eff;
        --title-color: #fff;
        --title-background: #7bd;
        --warning-title: #800;
        --warning-content: #400;
        --info-title: #a50;
        --info-content: #420;
        --note-title: #069;
        --note-content: #023;
        --tip-title: #363;
        --tip-content: #121;
    }

    .notice {
        padding: 18px;
        line-height: 24px;
        margin-bottom: 24px;
        border-radius: 4px;
        color: var(--root-color);
        background: var(--root-background);
    }

    .notice p:last-child {
        margin-bottom: 0;
    }

    .notice-title {
        margin: -18px -18px 12px;
        padding: 4px 18px;
        border-radius: 4px 4px 0 0;
        font-weight: 700;
        color: var(--title-color);
        background: var(--title-background);
    }

    .notice.warning .notice-title {
        background: var(--warning-title);
    }

    .notice.warning {
        background: var(--warning-content);
    }

    .notice.info .notice-title {
        background: var(--info-title);
    }

    .notice.info {
        background: var(--info-content);
    }

    .notice.note .notice-title {
        background: var(--note-title);
    }

    .notice.note {
        background: var(--note-content);
    }

    .notice.tip .notice-title {
        background: var(--tip-title);
    }

    .notice.tip {
        background: var(--tip-content);
    }

    .icon-notice {
        display: inline-flex;
        align-self: center;
        margin-right: 8px;
    }

    .icon-notice img, .icon-notice svg {
        height: 1em;
        width: 1em;
        fill: currentColor;
    }

    .icon-notice img, .icon-notice.baseline svg {
        top: .125em;
        position: relative;
    }
</style><div class="notice tip" >
    <p class="notice-title">
        <span class="icon-notice baseline">
            <svg xmlns="http://www.w3.org/2000/svg" height="20" viewBox="0 -960 960 960" width="20"><path d="m429-336 238-237-51-51-187 186-85-84-51 51 136 135Zm51 240q-79 0-149-30t-122.5-82.5Q156-261 126-331T96-480q0-80 30-149.5t82.5-122Q261-804 331-834t149-30q80 0 149.5 30t122 82.5Q804-699 834-629.5T864-480q0 79-30 149t-82.5 122.5Q699-156 629.5-126T480-96Z"/></svg>
        </span>Tip</p><p><strong>Apple Notes</strong> now allows crating links to notes from any text, which exposes the note url via an easy “<strong>Copy link</strong>” action:</p>
<ul>
<li><a href="https://support.apple.com/guide/notes/add-links-apde615d29c2/mac#apd01aa2d97c">Add links in Notes on Mac # Link to another note - Apple Support</a></li>
<li><a href="https://support.apple.com/guide/iphone/add-links-iph908d1558b/ios#iph311d60862">Add links in Notes on iPhone # Link to another note using custom link text - Apple Support</a></li>
</ul></div>

<ul>
<li>To find out the id of a Note use shortcut <a href="https://showcuts.app/share/view/e370c4eacc7441a18e7ec95667b2e32f">Get URL of Note</a> (via <a href="https://www.reddit.com/r/shortcuts/comments/aot272/get_url_of_note_copy_note_url_to_clipboard">iBanks3</a>)</li>
</ul>
<ol>
<li>
<p>Run shortcut <strong>Get URL of Note</strong></p>
</li>
<li>
<p>Enter node <code>Note</code> and check the <code>LNEntity</code> Supported Type to get the UUID, e.g.:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-xml" data-lang="xml"><span class="line"><span class="cl"><span class="nt">&lt;LNEntity:</span> <span class="err">0x123456789,</span> <span class="err">identifier:</span> <span class="err">NoteEntity/applenotes:note/12345678-abcd-bcde-cdef-123456789012,</span> <span class="err">...</span>
</span></span></code></pre></div><p>➔<code>12345678-abcd-bcde-cdef-123456789012</code></p>
</li>
<li>
<p>Convert the UUID to ALL CAPS (<em>for example, using <a href="https://convertcase.net/">Convert Case</a> or the <strong>Pages</strong> app</em>):</p>
<p>➔<code>12345678-ABCD-BCDE-CDEF-123456789012</code></p>
</li>
<li>
<p>Append it to the url sheme to open Notes:</p>
<p><mark>➔<code>applenotes://showNote?identifier=12345678-ABCD-BCDE-CDEF-123456789012</code></mark></p>
</li>
</ol>
<p><em>Note</em>: Sometimes you might get the following error:</p>
<blockquote>
<p><strong>An error occurred while running Get URL of Note</strong><br>
Couldn&rsquo;t communicate with a helper application.</p>
</blockquote>
<p>I haven’t found any way around it other than trying again some other time 🤷‍♂️ — restarts haven’t helped at all.</p>
<h2 id="enable-touch-id-for-sudo">Enable Touch ID for sudo</h2>
<ul>
<li><a href="https://sixcolors.com/post/2020/11/quick-tip-enable-touch-id-for-sudo/">Quick Tip: Enable Touch ID for sudo – Six Colors</a></li>
</ul>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl"><span class="nb">cd</span> /etc/pam.d/ <span class="o">&amp;&amp;</span> sudo chmod a+w sudo <span class="o">&amp;&amp;</span> vi sudo <span class="o">&amp;&amp;</span> sudo chmod a-w sudo <span class="o">&amp;&amp;</span> <span class="nb">cd</span> -
</span></span></code></pre></div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl"><span class="c1"># sudo: auth account password session</span>
</span></span><span class="line"><span class="cl">auth       sufficient     pam_tid.so        <span class="c1"># &lt;= add this line here</span>
</span></span><span class="line"><span class="cl">auth       sufficient     pam_smartcard.so
</span></span><span class="line"><span class="cl">auth       required       pam_opendirectory.so
</span></span><span class="line"><span class="cl">account    required       pam_permit.so
</span></span><span class="line"><span class="cl">password   required       pam_deny.so
</span></span><span class="line"><span class="cl">session    required       pam_permit.so
</span></span></code></pre></div><h2 id="remove-quarantine">Remove quarantine</h2>
<p><em>… “‘command’ cannot be opened because the developer cannot be verified.”</em></p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">xattr -d com.apple.quarantine /usr/local/bin/cmd
</span></span></code></pre></div><h2 id="file-extended-attributes">File extended attributes</h2>
<p><em>… list attributes</em></p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">ls -l -@ file
</span></span><span class="line"><span class="cl">xattr file
</span></span></code></pre></div><p><em>… show values</em></p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">xattr -l file
</span></span><span class="line"><span class="cl">xattr -p attribute file
</span></span></code></pre></div><h2 id="add-to-sudoers-without-needing-a-restart">Add to sudoers without needing a restart</h2>
<ul>
<li><a href="https://apple.stackexchange.com/questions/76088/how-do-i-give-a-user-sudo-permissions/76096#76096">macos - How do I give a user sudo permissions? - Ask Different</a></li>
</ul>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">su - admin
</span></span></code></pre></div><p><em>… add</em></p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">sudo dseditgroup -o edit -a hugo -t user admin
</span></span><span class="line"><span class="cl">sudo dseditgroup -o edit -a hugo -t user wheel
</span></span></code></pre></div><p><em>… delete</em></p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">sudo dseditgroup -o edit -d hugo -t user admin
</span></span><span class="line"><span class="cl">sudo dseditgroup -o edit -d hugo -t user wheel
</span></span></code></pre></div><h2 id="create-encrypted-zip-file">Create encrypted zip file</h2>
<ul>
<li><a href="http://www.koozie.org/blog/2014/08/creating-aes256-encrypted-zip-archive-files-mac-command-line/">Creating AES256 encrypted Zip Archive Files on a Mac from the Command Line</a></li>
<li><a href="https://security.stackexchange.com/questions/186128/what-encryption-method-is-used-by-the-zip-program-in-macos/186132#186132">macosx - What encryption method is used by the zip program in macOS? - Information Security Stack Exchange</a></li>
</ul>
<p><em>… install</em></p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">brew install p7zip
</span></span></code></pre></div><p><em>… create</em></p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">7za a -tzip -mem<span class="o">=</span>AES256 -p secrets-encrypted.zip secrets/
</span></span><span class="line"><span class="cl">7za x secrets-encrypted.zip
</span></span></code></pre></div><h2 id="view-and-change-file-flags">View and change file flags</h2>
<p><em>… invisible = <code>hidden</code>; visible = <code>nohidden</code></em></p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">$ touch seeme hideme
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">$ chflags hidden hideme
</span></span><span class="line"><span class="cl">$ chflags nohidden seeme
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">$ ls -lO *me  <span class="c1"># -O is an “oh” not a “zero”</span>
</span></span><span class="line"><span class="cl">-rw-r--r--  <span class="m">1</span> hugo  staff  hidden <span class="m">0</span> Mar <span class="m">12</span> 11:28 hideme
</span></span><span class="line"><span class="cl">-rw-r--r--  <span class="m">1</span> hugo  staff  -      <span class="m">0</span> Mar <span class="m">12</span> 11:28 seeme
</span></span></code></pre></div><h2 id="reset-unlocking-macbook-by-apple-watch">Reset unlocking MacBook by Apple Watch</h2>
<ul>
<li>In <strong>Messages</strong>
<ul>
<li>Preferences ➤ Accounts</li>
<li>Sign Out</li>
<li>Sign In</li>
</ul>
</li>
<li>In <strong>System Preferences</strong>
<ul>
<li>Security &amp; Privacy</li>
<li>Check “Allow your Apple Watch to unlock you Mac”</li>
</ul>
</li>
</ul>
<h2 id="why-does-it-keep-waking-from-sleep">Why does it keep waking from sleep?</h2>
<ul>
<li><a href="https://support.apple.com/en-us/HT204760">If your Mac doesn&rsquo;t sleep or wake when expected - Apple Support</a></li>
<li><a href="http://osxdaily.com/2010/07/17/why-mac-wakes-from-sleep/">Determine Why Your Mac Wakes Up From Sleep</a></li>
</ul>
<p><em>… definition of log terms</em></p>
<ul>
<li><strong>OHC</strong> (Open Host Controller) is usually USB or Firewire. OHC1 or OHC2 is almost certainly an <strong>external USB keyboard or mouse</strong></li>
<li><strong>EHC</strong> (Enhanced Host Controller) is another USB interface, but can also be <strong>wireless devices and bluetooth</strong></li>
<li><strong>USB</strong> when a USB device woke the machine up</li>
<li><strong>LID0</strong> when you open the lid the machine wakes up from sleep</li>
<li><strong>PWRB</strong> (Power Button) which is the <strong>physical power button</strong> on your Mac</li>
<li><strong>RTC</strong> (Real Time Clock Alarm) is generally from <strong>wake-on-demand services</strong>
<ul>
<li>Schedule sleep and wake via the Energy Saver control panel</li>
<li><code>launchd</code> setting</li>
<li>User applications</li>
<li>Backups</li>
<li>Other scheduled events</li>
</ul>
</li>
</ul>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">log show --last 1d --predicate <span class="s1">&#39;eventMessage contains &#34;Wake reason&#34;&#39;</span>
</span></span><span class="line"><span class="cl">log show --last 1d <span class="p">|</span> grep -C15 -i <span class="s2">&#34;wake reason&#34;</span>
</span></span></code></pre></div><h2 id="delete-old-time-machine-backups">Delete old Time Machine backups</h2>
<ul>
<li><a href="https://apple.stackexchange.com/questions/39287/how-can-i-manually-delete-old-backups-to-free-space-for-time-machine/55646#55646">macos - How can I manually delete old backups to free space for Time Machine? - Ask Different</a></li>
<li><a href="https://apple.stackexchange.com/a/404761">time machine - Remove unnecessary backups from TimeMachine to get space - Ask Different</a></li>
</ul>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">tmutil listbackups
</span></span><span class="line"><span class="cl">sudo tmutil delete /Volumes/<span class="o">[</span>Disk<span class="o">]</span>/Backups.backupdb/<span class="o">[</span>Name<span class="o">]</span>/2000-00-00-000000
</span></span><span class="line"><span class="cl">sudo tmutil delete /Volumes/<span class="o">[</span>Disk<span class="o">]</span>/Backups.backupdb/<span class="o">[</span>Name<span class="o">]</span>/2000-*
</span></span></code></pre></div><h2 id="use-keychain-for-unlocking-ssh-private-key">Use Keychain for unlocking SSH private key</h2>
<ul>
<li><a href="http://apple.stackexchange.com/questions/254468/macos-sierra-doesn-t-seem-to-remember-ssh-keys-between-reboots/264974#264974">terminal - macOS Sierra doesn’t seem to remember SSH keys between reboots - Ask Different</a></li>
</ul>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">Host *
</span></span><span class="line"><span class="cl">   AddKeysToAgent yes
</span></span><span class="line"><span class="cl">   UseKeychain yes
</span></span><span class="line"><span class="cl">   IdentityFile ~/.ssh/id_rsa
</span></span></code></pre></div><h2 id="spoof-mac-address">Spoof MAC address</h2>
<ul>
<li><a href="http://osxdaily.com/2012/03/01/change-mac-address-os-x/">Change (Spoof) a MAC Address in OS X Mountain Lion &amp; Mavericks</a></li>
</ul>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">openssl rand -hex <span class="m">6</span> <span class="p">|</span> sed <span class="s1">&#39;s/\(..\)/\1:/g; s/.$//&#39;</span>  <span class="c1"># make</span>
</span></span><span class="line"><span class="cl">sudo ifconfig en0 ether xx:xx:xx:xx:xx:xx  <span class="c1"># set</span>
</span></span><span class="line"><span class="cl">ifconfig en0 <span class="p">|</span>grep ether  <span class="c1"># check</span>
</span></span></code></pre></div><h2 id="consult-timestamps-on-safari-history">Consult timestamps on Safari history</h2>
<ul>
<li><a href="http://stackoverflow.com/a/34546556/1380781">sqlite - What format is the Safari History.db history_visits.visit_time in? - Stack Overflow</a></li>
<li><a href="https://apple.stackexchange.com/a/313670/66527">See website visit time in Safari history - Ask Different</a></li>
</ul>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">$ sqlite3 ~/Library/Safari/History.db
</span></span><span class="line"><span class="cl">sqlite&gt; .headers on
</span></span></code></pre></div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sql" data-lang="sql"><span class="line"><span class="cl"><span class="k">select</span><span class="w"> </span><span class="n">datetime</span><span class="p">(</span><span class="n">v</span><span class="p">.</span><span class="n">visit_time</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">978307200</span><span class="p">,</span><span class="w"> </span><span class="s1">&#39;unixepoch&#39;</span><span class="p">,</span><span class="w"> </span><span class="s1">&#39;localtime&#39;</span><span class="p">)</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="nb">date</span><span class="p">,</span><span class="w"> </span><span class="n">v</span><span class="p">.</span><span class="n">visit_time</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">978307200</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">epoch</span><span class="p">,</span><span class="w"> </span><span class="n">v</span><span class="p">.</span><span class="n">visit_time</span><span class="p">,</span><span class="w"> </span><span class="n">i</span><span class="p">.</span><span class="n">domain_expansion</span><span class="p">,</span><span class="w"> </span><span class="n">i</span><span class="p">.</span><span class="n">url</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="k">from</span><span class="w"> </span><span class="n">history_items</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="k">left</span><span class="w"> </span><span class="k">join</span><span class="w"> </span><span class="n">history_visits</span><span class="w"> </span><span class="n">v</span><span class="w"> </span><span class="k">on</span><span class="w"> </span><span class="n">i</span><span class="p">.</span><span class="n">id</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">v</span><span class="p">.</span><span class="n">history_item</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="k">order</span><span class="w"> </span><span class="k">by</span><span class="w"> </span><span class="n">i</span><span class="p">.</span><span class="n">id</span><span class="w"> </span><span class="k">desc</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="k">limit</span><span class="w"> </span><span class="mi">100</span><span class="p">;</span><span class="w">
</span></span></span></code></pre></div><p>Quick one-liner to paste into the Terminal:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">sqlite3 ~/Library/Safari/History.db <span class="s2">&#34;select datetime(v.visit_time + 978307200, &#39;unixepoch&#39;, &#39;localtime&#39;) as date, v.title, i.url from history_items i left join history_visits v on i.id = v.history_item order by v.visit_time desc;&#34;</span> <span class="p">|</span> less
</span></span></code></pre></div><h2 id="homebrew-remove-formula-and-its-dependencies-if-not-in-use">Homebrew: Remove formula and its dependencies, if not in use</h2>
<ul>
<li><a href="https://github.com/Homebrew/homebrew/issues/7465#issuecomment-49252187">Add an option to <code>brew rm</code> to uninstall / remove a package, including all it&rsquo;s dependencies. · Issue #7465 · Homebrew/homebrew</a></li>
<li><a href="https://github.com/beeftornado/homebrew-rmtree">beeftornado/homebrew-rmtree - Ruby</a></li>
</ul>
<p><em>… installing command</em></p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">brew tap beeftornado/rmtree <span class="o">&amp;&amp;</span> brew install brew-rmtree
</span></span></code></pre></div><p><em>… removing a formula</em></p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">brew rmtree --dry-run formula
</span></span></code></pre></div><h2 id="homebrew-show-installed-formulae-and-dependencies">Homebrew: Show installed formulae and dependencies</h2>
<p><em>… top-level only</em></p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">brew leaves
</span></span></code></pre></div><p><em>… all dependencies</em></p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">brew deps --installed <span class="o">[</span>--tree<span class="o">]</span>
</span></span></code></pre></div><p><em>… what uses a dependency</em></p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">brew uses --installed --recursive formula
</span></span></code></pre></div><h2 id="homebrew-quick-guide">Homebrew quick guide</h2>
<ul>
<li><a href="https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/FAQ.md#faq">homebrew/FAQ.md at master · Homebrew/homebrew · GitHub</a></li>
</ul>
<p><em>… installed things</em></p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">brew list
</span></span></code></pre></div><p><em>… bumping version</em></p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">brew update                       <span class="c1"># Homebrew itself</span>
</span></span><span class="line"><span class="cl">brew outdated                     <span class="c1"># Formulas</span>
</span></span><span class="line"><span class="cl">brew upgrade <span class="o">[</span><span class="nv">$FORMULA</span><span class="o">]</span>           <span class="c1"># Formulas</span>
</span></span></code></pre></div><p><em>… clearing things</em></p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">brew list --versions --multiple
</span></span><span class="line"><span class="cl">brew cleanup -n                   <span class="c1"># dry run</span>
</span></span><span class="line"><span class="cl">brew cleanup <span class="o">[</span><span class="nv">$FORMULA</span><span class="o">]</span>
</span></span></code></pre></div><h2 id="homebrew-using-caskroom-sources">Homebrew: Using Caskroom sources</h2>
<ul>
<li><a href="http://caskroom.io/">Homebrew Cask</a></li>
</ul>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">brew tap caskroom/cask
</span></span><span class="line"><span class="cl">brew cask info Caskroom/cask/rowanj-gitx
</span></span></code></pre></div><h2 id="test-and-debug-launchagents-and-launchdaemons">Test and debug LaunchAgents and LaunchDaemons</h2>
<ul>
<li><a href="http://tim.vanwerkhoven.org/post/2011/11/17/OSX-launchd-and-launchctl-issues">OSX launchd and launchctl issues - Tim&rsquo;s blag</a></li>
</ul>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">sudo launchctl log level debug
</span></span><span class="line"><span class="cl">tail -f /var/log/system.log
</span></span><span class="line"><span class="cl">sudo launchctl log level error
</span></span></code></pre></div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">launchctl list <span class="o">[</span>cc.ferreira.backlog.daily<span class="o">]</span>
</span></span><span class="line"><span class="cl">launchctl start cc.ferreira.backlog.daily
</span></span></code></pre></div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">launchctl unload -w ~/Library/LaunchAgents/cc.ferreira.backlog.daily.plist 
</span></span><span class="line"><span class="cl">launchctl load -w ~/Library/LaunchAgents/cc.ferreira.backlog.daily.plist 
</span></span></code></pre></div><h2 id="resolve-host-from-ip">Resolve host from IP</h2>
<ul>
<li><em>with zeroconf / Multicast DNS / mDNS</em></li>
</ul>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">dig +short -x 192.168.1.65 -p <span class="m">5353</span> @224.0.0.251
</span></span></code></pre></div><h2 id="disablerevoke-disk-decryption-from-a-user">Disable/revoke disk decryption from a user</h2>
<ul>
<li><em>for FileVault 2</em></li>
<li><a href="http://apple.stackexchange.com/questions/18358/disable-a-users-ability-to-unlock-a-filevault-2-volume-at-startup-login-time/53803#53803">osx - Disable a user&rsquo;s ability to unlock a FileVault 2 volume at startup/login time - Ask Different</a></li>
<li><a href="http://www.tuaw.com/2011/12/12/prevent-certain-accounts-from-unlocking-filevault-2/">Prevent certain accounts from unlocking FileVault 2 | TUAW - The Unofficial Apple Weblog</a></li>
</ul>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">$ sudo su - testing  
</span></span><span class="line"><span class="cl">$ passwd 
</span></span><span class="line"><span class="cl">Changing password <span class="k">for</span> charlie.
</span></span><span class="line"><span class="cl">Old Password:                     <span class="c1"># [enter old password here]</span>
</span></span><span class="line"><span class="cl">New Password:                     <span class="c1"># [press enter]</span>
</span></span><span class="line"><span class="cl">Retype New Password:              <span class="c1"># [press enter]</span>
</span></span></code></pre></div><ul>
<li>System Preferences ➤ Security &amp; Privacy ➤ FileVault
<ul>
<li>Enable Users …</li>
<li>Set Password …</li>
</ul>
</li>
</ul>
<h2 id="create-user-manually-without-disk-encryption-rights">Create user manually without disk encryption rights</h2>
<ul>
<li><em>for FileVault 2</em></li>
</ul>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">sudo dscl /Local/Default -create /Users/testing
</span></span><span class="line"><span class="cl">sudo dscl /Local/Default -create /Users/testing UserShell /bin/bash
</span></span><span class="line"><span class="cl">sudo dscl /Local/Default -create /Users/testing RealName <span class="s2">&#34;Testing&#34;</span>
</span></span><span class="line"><span class="cl">sudo dscl /Local/Default -create /Users/testing UniqueID <span class="m">503</span>
</span></span><span class="line"><span class="cl">sudo dscl /Local/Default -create /Users/testing PrimaryGroupID <span class="m">1000</span>
</span></span><span class="line"><span class="cl">sudo dscl /Local/Default -create /Users/testing NFSHomeDirectory /Users/testing
</span></span><span class="line"><span class="cl">sudo passwd testing
</span></span></code></pre></div><h2 id="check-user-definitions">Check user definitions</h2>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">sudo dscl /Local/Default -read /Users/testing
</span></span></code></pre></div><h2 id="where-the-modem-passwords-are-stored">Where the modem passwords are stored</h2>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">cat /Library/Preferences/SystemConfiguration/preferences.plist
</span></span></code></pre></div><h2 id="where-the-dhcp-leases-are-stored">Where the dhcp leases are stored</h2>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">cat /var/db/dhcpd_leases
</span></span></code></pre></div><h2 id="flush-dns-cache">Flush DNS cache</h2>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">sudo dscacheutil -flushcache
</span></span></code></pre></div><h2 id="force-spotlight-to-re-index">Force Spotlight to re-index</h2>
<ul>
<li><a href="http://support.apple.com/kb/HT2409">Spotlight: How to re-index folders or volumes</a></li>
</ul>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">sudo mdutil -E /
</span></span></code></pre></div><h2 id="remove-duplicates-in-the-open-with-menu">Remove duplicates in the &ldquo;Open With&rdquo; menu</h2>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl"><span class="nb">cd</span> /System/Library/Frameworks/ApplicationServices.framework/<span class="se">\F</span>rameworks/LaunchServices.framework/Support/
</span></span><span class="line"><span class="cl">lsregister -kill -r -domain <span class="nb">local</span> -domain system -domain user
</span></span></code></pre></div><h2 id="view-resource-forks"><del>View resource forks</del></h2>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl"><span class="c1"># DEPRECATED: ls -l path/to/file/rsrc</span>
</span></span></code></pre></div><h2 id="mysql-server">MySQL server</h2>
<p><em>… MacPorts</em></p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">su - admin -c <span class="s2">&#34;sudo mysql.server start | stop | …&#34;</span>
</span></span></code></pre></div><p><em>… Homebrew</em></p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">su - admin<span class="p">;</span> mysql.server start <span class="p">|</span> stop <span class="p">|</span> …
</span></span></code></pre></div><h2 id="iphoto-speedup">iPhoto speedup</h2>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl"><span class="nb">cd</span> Pictures/iPhoto<span class="se">\ </span>Library/
</span></span><span class="line"><span class="cl"><span class="k">for</span> db in *.db<span class="p">;</span> <span class="k">do</span>
</span></span><span class="line"><span class="cl">    sqlite3 <span class="nv">$db</span> <span class="s2">&#34;vacuum;&#34;</span>
</span></span><span class="line"><span class="cl"><span class="k">done</span>
</span></span></code></pre></div><h2 id="stop-nmbd">Stop nmbd</h2>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">sudo launchctl unload /System/Library/LaunchDaemons/nmbd.plist
</span></span></code></pre></div><h2 id="quit-application">Quit application</h2>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">osascript -e <span class="s1">&#39;tell app &#34;iCal&#34; to quit&#39;</span>
</span></span></code></pre></div><h2 id="old-style-sleep-mode">“Old” style sleep mode</h2>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">pmset -g <span class="p">|</span> grep hibernatemode
</span></span><span class="line"><span class="cl">sudo pmset -a hibernatemode <span class="m">0</span>
</span></span></code></pre></div><h2 id="eject-cd">Eject cd</h2>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">drutil tray eject
</span></span></code></pre></div><h2 id="text-styles-and-substitutions">Text styles and substitutions</h2>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">open ~/Library/Preferences/.GlobalPreferences.plist
</span></span><span class="line"><span class="cl"><span class="c1"># See `NSFavoriteStyles`</span>
</span></span><span class="line"><span class="cl"><span class="c1"># See `NSUserReplacementItems`</span>
</span></span></code></pre></div><h2 id="open-man-pages-in-pdf">Open man pages in PDF</h2>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">man -t opensnoop <span class="p">|</span> open -f -a /Applications/Preview.app
</span></span></code></pre></div><h2 id="startstop-local-ftp-server">Start/Stop local FTP Server</h2>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">sudo -s launchctl load -w /System/Library/LaunchDaemons/ftp.plist
</span></span></code></pre></div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">sudo -s launchctl unload -w /System/Library/LaunchDaemons/ftp.plist
</span></span></code></pre></div>]]></content:encoded>
    </item>
  </channel>
</rss>
