Homebrew Paketmanager für Mac OS X

Aus Wikizone
Wechseln zu: Navigation, Suche

Einleitung

Der Homebrew Paketmanager ist recht praktisch wenn man viel mit Entwicklertools arbeiten möchte. NodeJS z.B.und anderes läßt sich damit schnell installieren und deinstallieren.

Schnelleinstieg

brew doctor # Findet Probleme - ab und zu mal eingeben
brew install [Paketname]
brew info [Paketname] # z.B. brew info phpmyadmin gibt infos zur Installation und Gebrauch

Übersicht von brew.sh

https://brew.sh/index_de.html

Homebrew installiert die Sachen, die Du brauchst und die bei Apple nicht dabei sind.

$ brew install wget

Homebrew installiert Pakete in ihrem eigenen Verzeichnis und erstellt dann Symlinks der Dateien in /usr/local.

 $ cd /usr/local
 $ find Cellar
 Cellar/wget/1.15
 Cellar/wget/1.15/bin/wget
 Cellar/wget/1.15/share/man/man1/wget.1

 $ ls -l bin
 bin/wget -> ../Cellar/wget/1.15/bin/wget

Homebrew installiert keine Dateien außerhalb seines Präfixes und Du kannst den Ort einer Homebrew-Installation frei wählen.

Eigene Homebrew-Pakete zu erzeugen, ist kinderleicht.

$ brew create http://foo.com/bar-1.0.tgz
Created /usr/local/Library/Formula/bar.rb

Unter der Haube werden git und ruby verwendet. Modifikationen sind also schnell rückgängig gemacht und Upstream-Änderungen lassen sich leicht mergen.

$ brew edit wget # opens in $EDITOR!

Homebrew-Formeln sind einfache Ruby-Skripte:

require "formula"

class Wget < Formula
  homepage "https://www.gnu.org/software/wget/"
  url "https://ftp.gnu.org/gnu/wget/wget-1.15.tar.gz"
  sha1 "f3c925f19dfe5ed386daae4f339175c108c50574"

  def install
    system "./configure", "--prefix=#{prefix}"
    system "make", "install"
  end
end

Homebrew ergänzt OS X. Installiere Deine Gems mit gem und ihre Abhängigkeiten mit brew.

Installiere Homebrew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"


Installationsnotizen

stephans-imac:~ stephan$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1
==> The following directories will be made group writable:
/usr/local/.
/usr/local/bin
/usr/local/share
/usr/local/share/man
/usr/local/share/man/man1
==> The following directories will have their group set to admin:
/usr/local/.
/usr/local/bin
/usr/local/share
/usr/local/share/man
/usr/local/share/man/man1

...

Warning: /usr/local/bin is not in your PATH.
==> Installation successful!
==> Next steps
Run `brew doctor` before you install anything
Run `brew help` to get started

PHP und Apache mit Homebrew

PHP

Mit Homebrew kann man PHP installieren

brew install php

Nach der Installation:

To enable PHP in Apache add the following to httpd.conf and restart Apache:
    LoadModule php7_module /usr/local/opt/php/lib/httpd/modules/libphp7.so

    <FilesMatch \.php$>
        SetHandler application/x-httpd-php
    </FilesMatch>

Finally, check DirectoryIndex includes index.php
    DirectoryIndex index.php index.html

The php.ini and php-fpm.ini file can be found in:
    /usr/local/etc/php/7.3/

To have launchd start php now and restart at login:
  brew services start php
Or, if you don't want/need a background service you can just run:
  php-fpm
==> Summary