pages tagged homebrew http://meng6net.localhost/tag/homebrew/ <p><small>Copyright © 2005-2020 by <code>Meng Lu &lt;lumeng3@gmail.com&gt;</code></small></p> Meng Lu's home page ikiwiki Tue, 04 Feb 2020 19:44:45 +0000 Installing and configuring mutt http://meng6net.localhost/computing/installing_and_configuring/installing_and_configuring_mutt/ http://meng6net.localhost/computing/installing_and_configuring/installing_and_configuring_mutt/ computing configuration documentation homebrew installation macOS note pkgsrc software to-do Tue, 04 Feb 2020 19:44:45 +0000 2020-02-04T19:44:45Z <h2>Intro to Mutt</h2> <p><a href="http://www.mutt.org/"><code>mutt</code></a> is a text-based mail client for Unix operating systems.</p> <h2>Installing <code>mutt</code></h2> <pre><code>brew install mutt </code></pre> <h2>Installing <code>getmail</code></h2> <pre><code>brew install getmail </code></pre> Installing and configuring Homebrew http://meng6net.localhost/computing/installing_and_configuring/installing_and_configuring_Homebrew/ http://meng6net.localhost/computing/installing_and_configuring/installing_and_configuring_Homebrew/ Homebrew computing configuration installation macOS note software to-do Sun, 02 Jul 2017 02:09:51 +0000 2017-07-02T02:09:51Z <h2>Topics</h2> <h2>How to upgrade if Homebrew stuck at an old version?</h2> <pre> <code>$ "$(brew --repo)" &amp;&amp; git fetch &amp;&amp; git reset --hard origin/master &amp;&amp; brew update </code></pre> Installing and configuring GNU command-line utilities http://meng6net.localhost/computing/installing_and_configuring/installing_and_configuring_command-line_utilities/ http://meng6net.localhost/computing/installing_and_configuring/installing_and_configuring_command-line_utilities/ command-line computing configuration documentation gnu homebrew installation note software Tue, 16 May 2017 23:59:39 +0000 2017-05-16T23:59:39Z <h2>History</h2> <ul> <li>Last content verification: 2017-5-1, macOS 10.12.4, Homebrew 1.2.0.</li> </ul> <h2>macOS</h2> <p>If you've installed any of the softwares before, but would like to re-install it, (possibly because you want to make sure it's installed with the options such as <code>--with-default-names</code>, use <code>brew reinstall ...</code> in place of <code>brew install</code>.</p> <h3>GNU core utilities</h3> <p>The GNU Core Utilities (<a href= "http://www.gnu.org/software/coreutils/">coreutils</a>) contains "the basic file, shell and text manipulation utilities of the GNU operating system."</p> <pre><code>brew install coreutils </code></pre> <h3>Other GNU utilities</h3> <p>Run the following if not already in the past:</p> <pre><code>brew tap homebrew/dupes </code></pre> <p>Install utilities:</p> <pre><code>brew install binutils brew install diffutils brew install ed --with-default-names # brew install findutils --with-default-names ## This will cause 'brew doctor' to issue warning: "Putting non-prefixed findutils in your path can cause python builds to fail." brew install findutils brew install gawk brew install gnu-indent --with-default-names brew install gnu-sed --with-default-names brew install gnu-tar --with-default-names brew install gnu-which --with-default-names brew install gnutls brew install grep --with-default-names brew install gzip brew install screen brew install watch brew install wdiff --with-gettext brew install wget brew install gnupg brew install gnupg2 </code></pre> <p>The following utilities already exist on macOS, but install the newest version from Homebrew:</p> <pre><code>brew install bash brew link --overwrite bash # brew install emacs brew install --cocoa --srgb emacs ## brew linkapps emacs brew install gdb # gdb requires further actions to make it work. See `brew info gdb`. brew install guile brew install gpatch brew install m4 brew install make brew install nano </code></pre> <p>macOS has the following non-GNU utilities, but you can install and use a newer version instead of the version shipped by macOS:</p> <pre><code>brew install file-formula brew install git brew install less brew install openssh brew install rsync brew install svn brew install unzip brew install vim --override-system-vi brew install macvim --with-override-system-vim --custom-system-icons brew link --overwrite macvim brew linkapps macvim brew install zsh </code></pre> <p>Install Perl:</p> <pre><code>brew tap homebrew/versions brew install perl518 # must run "brew tap homebrew/versions" first! </code></pre> <p>Install Python:</p> <pre><code>brew install python brew linkapps python pip install --upgrade pip setuptools </code></pre> <h3>Configuration in <code>.bashrc</code></h3> <p>If installed GNU utilities without using the default names:</p> <pre><code>brew install ed #--with-default-names brew install findutils #--with-default-names brew install gnu-indent #--with-default-names brew install gnu-sed #--with-default-names brew install gnu-tar #--with-default-names brew install gnu-which #--with-default-names brew install grep #--with-default-names </code></pre> <p>i.e., installing them without the <code>--with-default-names</code> option, Homebrew will install the formulae with the prefix "<code>g</code>". If you still need to use these commands with their normal names, you can add a "gnubin" directory to your <code>PATH</code> in file <code>~/.bashrc</code>:</p> <pre><code>PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH" PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH" PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH" ... # possibly others </code></pre> <p>Additionally, to make the man pages of the GNU versions of the utilities accessible via their normal names, add the <code>gnuman</code> directory to the <code>MANPATH</code> variable in the file <code>~/.bashrc</code>:</p> <pre> <code>MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH" MANPATH="/usr/local/opt/gnu-sed/libexec/gnuman:$MANPATH" MANPATH="/usr/local/opt/gnu-tar/libexec/gnuman:$MANPATH" ... # possibly others </code></pre> <p>But I recommend installing with the <code>--with-default-names</code> option whenever applicable.</p> <p>It seems <code>--with-default-names</code> is not applicable to the <code>coreutils</code> package, so</p> <pre><code>PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH" MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH" </code></pre> <p>always need to be applied.</p> <h3>Homebrew "caveats" and post-installation configuration</h3> <ul> <li><code>gdb</code></li> </ul> <p><code>gdb</code> requires special privileges to access Mach ports. You will need to codesign the binary. For instructions, see:</p> <p>http://sourceware.org/gdb/wiki/BuildingOnDarwin</p> <ul> <li> <p><code>openssl</code> and certificates</p> <pre><code> $ brew install wget ==&gt; Installing wget dependency: openssl ==&gt; Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2a-1.yosemite.bottle.1.tar.gz ######################################################################## 100.0% ==&gt; Pouring openssl-1.0.2a-1.yosemite.bottle.1.tar.gz ==&gt; Caveats A CA file has been bootstrapped using certificates from the system keychain. To add additional certificates, place .pem files in /usr/local/etc/openssl/certs and run /usr/local/opt/openssl/bin/c_rehash This formula is keg-only, which means it was not symlinked into /usr/local. macOS already provides this software and installing another version in parallel can cause all kinds of trouble. Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries Generally there are no consequences of this for you. If you build your own software and it requires this formula, you'll need to add to your build variables: LDFLAGS: -L/usr/local/opt/openssl/lib CPPFLAGS: -I/usr/local/opt/openssl/include ==&gt; Summary 🍺 /usr/local/Cellar/openssl/1.0.2a-1: 463 files, 18M ==&gt; Installing wget ==&gt; Downloading https://homebrew.bintray.com/bottles/wget-1.16.3.yosemite.bottle.tar.gz ######################################################################## 100.0% ==&gt; Pouring wget-1.16.3.yosemite.bottle.tar.gz 🍺 /usr/local/Cellar/wget/1.16.3: 9 files, 1.5M $ </code></pre></li> <li> <p>Git</p> <pre><code> $ brew install git ==&gt; Downloading https://homebrew.bintray.com/bottles/git-2.4.0.yosemite.bottle.tar.gz ######################################################################## 100.0% ==&gt; Pouring git-2.4.0.yosemite.bottle.tar.gz ==&gt; Caveats The macOS keychain credential helper has been installed to: /usr/local/bin/git-credential-osxkeychain The "contrib" directory has been installed to: /usr/local/share/git-core/contrib Bash completion has been installed to: /usr/local/etc/bash_completion.d zsh completion has been installed to: /usr/local/share/zsh/site-functions ==&gt; Summary 🍺 /usr/local/Cellar/git/2.4.0: 1368 files, 31M $ </code></pre></li> <li> <p><code>sqlite</code></p> <pre><code> $ brew install sqlite ==&gt; Installing subversion dependency: sqlite ==&gt; Downloading https://homebrew.bintray.com/bottles/sqlite-3.8.10.1.yosemite.bottle.tar.gz ######################################################################## 100.0% ==&gt; Pouring sqlite-3.8.10.1.yosemite.bottle.tar.gz ==&gt; Caveats This formula is keg-only, which means it was not symlinked into /usr/local. macOS already provides this software and installing another version in parallel can cause all kinds of trouble. macOS provides an older sqlite3. Generally there are no consequences of this for you. If you build your own software and it requires this formula, you'll need to add to your build variables: LDFLAGS: -L/usr/local/opt/sqlite/lib CPPFLAGS: -I/usr/local/opt/sqlite/include ==&gt; Summary 🍺 /usr/local/Cellar/sqlite/3.8.10.1: 9 files, 2.8M </code></pre></li> </ul> <h2><code>svn</code></h2> <pre><code>$ brew install svn ==&gt; Installing subversion ==&gt; Downloading https://homebrew.bintray.com/bottles/subversion-1.8.13.yosemite.bottle.tar.gz ######################################################################## 100.0% ==&gt; Pouring subversion-1.8.13.yosemite.bottle.tar.gz ==&gt; Caveats svntools have been installed to: /usr/local/opt/subversion/libexec Bash completion has been installed to: /usr/local/etc/bash_completion.d ==&gt; Summary 🍺 /usr/local/Cellar/subversion/1.8.13: 116 files, 9.4M $ </code></pre> <h2>(Ubuntu) Linux</h2> <p>There are only some of the command-line utilities which are not usually already installed:</p> <pre><code>sudo apt-get install indent sudo apt-get install gnupg2 sudo apt-get install python-pip sudo pip install --upgrade pip setuptools </code></pre> <h2>References</h2> <ul> <li> https://www.topbug.net/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-mac-os-x/</li> </ul> Installing and configuring pkgsrc http://meng6net.localhost/computing/installing_and_configuring/installing_and_configuring_pkgsrc/ http://meng6net.localhost/computing/installing_and_configuring/installing_and_configuring_pkgsrc/ computing configuration documentation homebrew installation macOS note pkgsrc software ssh to-do Sat, 08 Apr 2017 21:30:47 +0000 2017-08-29T18:50:07Z <h2>Intro to pkgsrc</h2> <p><a href="https://www.pkgsrc.org"><code>pkgsrc</code></a> is a package management system for Unix-like operating systems. It supports OS X. Therefore, it's an viable alternative to Homebrew and Macports, which are the most widely used package management systems on Mac computers. I originally became interested in trying pkgsrc because some softwares I would like to install are not available via Homebrew.</p> <h2>Install, configure, manage pkgsrc and software packages in it</h2> <h3>Installing and configuring pkgsrc on macOS (64-bit, version 10.9 or later)</h3> <p>The following is based on https://pkgsrc.joyent.com/install-on-osx/.</p> <ul> <li> <p>Copy and paste the lines below to install the 64-bit 10.9+ set.</p> <pre><code> BOOTSTRAP_TAR="bootstrap-trunk-x86_64-20170205.tar.gz" BOOTSTRAP_SHA="177e0be390b57ef9d7f61511a8169268000693df" </code></pre></li> <li> <p>Download the bootstrap kit to the current directory.</p> <pre> <code> curl -O https://pkgsrc.joyent.com/packages/Darwin/bootstrap/${BOOTSTRAP_TAR} </code></pre></li> <li> <p>Verify the SHA1 checksum.</p> <pre> <code> echo "${BOOTSTRAP_SHA} ${BOOTSTRAP_TAR}" &gt;check-shasum shasum -c check-shasum </code></pre></li> <li> <p>Verify PGP signature. This step is optional, and requires gpg.</p> <pre> <code> curl -O https://pkgsrc.joyent.com/packages/Darwin/bootstrap/${BOOTSTRAP_TAR}.asc gpg --recv-keys 0x1F32A9AD gpg --verify ${BOOTSTRAP_TAR}{.asc,} </code></pre></li> <li> <p>Install bootstrap kit to <code>/opt/pkg</code></p> <pre><code> sudo tar -zxpf ${BOOTSTRAP_TAR} -C / </code></pre></li> <li> <p>Reload <code>PATH/MANPATH</code> (pkgsrc installs <code>/etc/paths.d/10-pkgsrc</code> for new sessions)</p> <pre><code> eval $(/usr/libexec/path_helper) </code></pre></li> </ul> <h3>Installing pkgsrc on Ubuntu Linux</h3> <p>TODO</p> <h3>Installing softwares</h3> <p>There are three ways of installing softwares using pkgsrc:</p> <ol> <li>The most typical method is to build a software from source files, a.k.a. "bootstrapping";</li> <li>Another possibly easier method is to install and uninstall pre-built softwares using commands <code>pkg_add</code> and <code>pkg_delete</code>, respectively;</li> <li>Install softwares using the high-level tool <code>pkgin</code>. It's the facsimile of Ubuntu and Debian Linux's <code>apt-get</code> in pkgsrc.</li> </ol> <h3>Use pkgsrc to install softwares</h3> <p>Use pkgsrc to install some softwares that Homebrew can't.</p> <ul> <li> <p>Refresh the pkgin database with the latest version</p> <pre><code> $ sudo pkgin -y update </code></pre></li> <li> <p>Search for a package. Regular expressions are supported.</p> <pre><code> $ pkgin search "^ffmpeg[0-9]$" ffmpeg3-3.0.1 Decoding, encoding and streaming software (v3.x) ffmpeg2-2.8.6 Decoding, encoding and streaming software (v2.x) ffmpeg1-1.2.12 Decoding, encoding and streaming software (v1.x) </code></pre></li> <li> <p>Install a package without prompting</p> <pre><code> $ sudo pkgin -y install ffmpeg3 </code></pre></li> <li> <p>List all available packages</p> <pre><code> $ pkgin avail </code></pre></li> <li> <p>Upgrade all out-of-date packages</p> <pre><code> $ sudo pkgin -y full-upgrade </code></pre></li> <li> <p>Remove a package</p> <pre><code> $ sudo pkgin -y remove ffmpeg2 </code></pre></li> <li> <p>Automatically remove orphaned dependencies</p> <pre><code> $ sudo pkgin -y autoremove </code></pre></li> </ul> <h3>Use pkg_* tools to manage packages</h3> <ul> <li> <p>See what packages are installed.</p> <pre><code> $ pkg_info </code></pre></li> <li> <p>See what package a file belongs to.</p> <pre><code> $ pkg_info -Fe /opt/pkg/bin/node nodejs-4.4.3 </code></pre></li> <li> <p>List the contents of a package.</p> <pre><code> $ pkg_info -qL nodejs /opt/pkg/bin/node /opt/pkg/bin/npm [...] </code></pre></li> <li> <p>Perform an audit of all currently installed packages.</p> <pre><code> $ sudo pkg_admin fetch-pkg-vulnerabilities $ pkg_admin audit Package jasper-1.900.1nb11 has a integer-overflow vulnerability, see http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-3520 Package samba-3.6.25nb3 has a privilege-escalation vulnerability, see https://www.samba.org/samba/security/CVE-2015-5299.html Package tiff-4.0.6 has a arbitrary-memory-access vulnerability, see http://www.securityfocus.com/archive/1/537205 [...] </code></pre></li> <li> <p>Create a binary package from some metadata files and package directory.</p> <pre> <code> $ pkg_create -B build-info -c comment -d description -f packlist -I /opt/pkg -p files/ -U foo-1.0.tgz </code></pre></li> </ul> <h2>Configuration file <code>mk.conf</code> for "bootstrapping"</h2> <p>After running</p> <pre><code>pkgsrc/bootstrap </code></pre> <p>it creates a example configuration file <code>../pkgsrc/bootstrap/work/mk.conf.example</code>:</p> <pre> <code># Example /usr/pkg/etc/mk.conf file produced by bootstrap-pkgsrc # Sat Feb 7 20:20:18 PST 2015 .ifdef BSD_PKG_MK # begin pkgsrc settings PKGSRC_COMPILER= clang CC= clang CXX= clang++ CPP= ${CC} -E CLANGBASE= /usr PKG_DBDIR= /var/db/pkg LOCALBASE= /usr/pkg VARBASE= /var PKG_TOOLS_BIN= /usr/pkg/sbin PKGINFODIR= info PKGMANDIR= man TOOLS_PLATFORM.awk?= /usr/pkg/bin/nawk TOOLS_PLATFORM.sed?= /usr/pkg/bin/nbsed .endif # end pkgsrc settings </code></pre> <p>Here is a version that is customized and installed at <code>/usr/pkg/etc/mk.conf</code>:</p> <pre><code>.ifdef BSD_PKG_MK # begin pkgsrc settings ABI= 64 PKGSRC_COMPILER= clang CC= clang CXX= clang++ CPP= ${CC} -E CLANGBASE= /usr PKG_DBDIR= /usr/pkg/.pkgdb LOCALBASE= /usr/pkg VARBASE= /var PKG_TOOLS_BIN= /usr/pkg/sbin PKGINFODIR= info PKGMANDIR= man TOOLS_PLATFORM.awk?= /usr/pkg/bin/nawk TOOLS_PLATFORM.sed?= /usr/pkg/bin/nbsed MULTILIB_SUPPORTED= no PREFER.openssl= pkgsrc X11_TYPE= native X11BASE= /opt/X11 .if !empty(PKGPATH:Mmail/mutt-devel) PKG_OPTIONS.mutt+= mutt-hcache mutt-smtp ncursesw sasl .endif .endif # end pkgsrc settings </code></pre> <h2>Uninstalling pkgsrc and softwares installed by it</h2> <p>Delete the following directories:</p> <pre><code>sudo rm -rf /usr/pkg sudo rm -rf /var/db/pkg* </code></pre> <p>and possibly also the source files if you used the first method:</p> <pre><code>sudo rm -rf /path/to/pkgsrc </code></pre> <h2>References</h2> <ul> <li> <p>Wikipedia, <a href= "https://en.wikipedia.org/wiki/Pkgsrc">Pkgsrc</a>.</p> </li> <li> <p>Tony Fischetti, <a href= "http://www.onthelambda.com/2013/10/14/the-state-of-package-management-on-mac-os-x/"> The state of package management on macOS</a>, Oct. 14, 2013</p> </li> <li> <p>pkgsrc: http://pkgsrc.org/</p> </li> <li> <p>pkgsrc.se: http://pkgsrc.se/</p> </li> <li> <p>pkgin: http://pkgin.net/</p> </li> <li> <p> http://www.perkin.org.uk/pages/pkgsrc-binary-packages-for-osx.html</p> </li> <li> <p> http://www.onthelambda.com/2013/10/14/the-state-of-package-management-on-mac-os-x/</p> </li> <li> <p><a href= "http://www.perkin.org.uk/pages/pkgsrc-binary-packages-for-osx.html"> <em>pkgsrc binary packages for Mac OSX</em></a>.</p> </li> </ul>