Homebrew Paketmanager für Mac OS X: Unterschied zwischen den Versionen

Aus Wikizone
Wechseln zu: Navigation, Suche
 
(Eine dazwischenliegende Version von einem anderen Benutzer wird nicht angezeigt)
Zeile 20: Zeile 20:
 
  brew install [Paketname]
 
  brew install [Paketname]
 
  brew info [Paketname] # z.B. brew info phpmyadmin gibt infos zur Installation und Gebrauch
 
  brew info [Paketname] # z.B. brew info phpmyadmin gibt infos zur Installation und Gebrauch
 +
 +
==== Update / Upgrade ====
 +
Updating Homebrew:
 +
brew update
 +
Upgrade all individual packages and formula:
 +
brew upgrade
 +
If Problems reinstall
 +
 +
Avoid updating certain formula:
 +
brew pin [name]
 +
have it be updated again:
 +
brew unpin [formula]
  
 
== Übersicht von brew.sh ==
 
== Übersicht von brew.sh ==
Zeile 69: Zeile 81:
  
 
=== Installationsnotizen ===
 
=== Installationsnotizen ===
 +
Homebrew gibt bei Upgrades und Installation einige Infos zu den installierten Tools aus:
 +
 +
 
<pre>
 
<pre>
 
stephans-imac:~ stephan$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
 
stephans-imac:~ stephan$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Zeile 96: Zeile 111:
 
Run `brew help` to get started
 
Run `brew help` to get started
 
</pre>
 
</pre>
 +
 +
=== Installationsnotizen zu Homebrew Tools ===
 +
 +
To use Homebrew in PowerShell, run the following in a PowerShell session:
 +
New-Item -Path (Split-Path -Parent -Path $PROFILE.CurrentUserAllHosts) -ItemType Directory -Force
 +
Add-Content -Path $PROFILE.CurrentUserAllHosts -Value '$(/usr/local/bin/brew shellenv) | Invoke-Expression'
 +
 +
==== httpd ====
 +
DocumentRoot is /usr/local/var/www.
 +
 +
The default ports have been set in /usr/local/etc/httpd/httpd.conf to 8080 and in
 +
/usr/local/etc/httpd/extra/httpd-ssl.conf to 8443 so that httpd can run without sudo.
 +
 +
To start httpd now and restart at login:
 +
brew services start httpd
 +
Or, if you don't want/need a background service you can just run:
 +
/usr/local/opt/httpd/bin/httpd -D FOREGROUND
 +
 +
 +
==== python@3.10 ====
 +
Python is installed as
 +
  /usr/local/bin/python3.10
 +
 +
Unversioned and major-versioned symlinks `python`, `python3`, `python-config`, `python3-config`, `pip`, `pip3`, etc. pointing to
 +
`python3.10`, `python3.10-config`, `pip3.10` etc., respectively, are installed into
 +
  /usr/local/opt/python@3.10/libexec/bin
 +
 +
You can install Python packages with
 +
  pip3.10 install <package>
 +
They will install into the site-package directory
 +
  /usr/local/lib/python3.10/site-packages
 +
 +
tkinter is no longer included with this formula, but it is available separately:
 +
  brew install python-tk@3.10
 +
 +
If you do not need a specific version of Python, and always want Homebrew's `python3` in your PATH:
 +
  brew install python3
 +
 +
See: https://docs.brew.sh/Homebrew-and-Python
 +
 +
==== nmap ====
 +
If using `ndiff` returns an error about not being able to import the ndiff module, try:
 +
  chmod go-w /usr/local/Cellar
 +
 
== PHP und Apache mit Homebrew ==
 
== PHP und Apache mit Homebrew ==
  

Aktuelle Version vom 25. Februar 2025, 18:43 Uhr

Einleitung[Bearbeiten]

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.

Links[Bearbeiten]

https://brew.sh/index_de.html - Am Besten hier starten.
Homebrew-Cask
Mac - Apache MySql PHP Server mit Homebrew

Schnelleinstieg[Bearbeiten]

Installieren[Bearbeiten]

Am Besten über: den obigen Link. Dort gibt es ein immer aktuelles Starter Script. Alt:

  • XCode Installieren
  • Terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Basics[Bearbeiten]

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

Update / Upgrade[Bearbeiten]

Updating Homebrew:

brew update

Upgrade all individual packages and formula:

brew upgrade

If Problems reinstall

Avoid updating certain formula:

brew pin [name]

have it be updated again:

brew unpin [formula]

Übersicht von brew.sh[Bearbeiten]

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[Bearbeiten]

Homebrew gibt bei Upgrades und Installation einige Infos zu den installierten Tools aus:


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

Installationsnotizen zu Homebrew Tools[Bearbeiten]

To use Homebrew in PowerShell, run the following in a PowerShell session:

New-Item -Path (Split-Path -Parent -Path $PROFILE.CurrentUserAllHosts) -ItemType Directory -Force
Add-Content -Path $PROFILE.CurrentUserAllHosts -Value '$(/usr/local/bin/brew shellenv) | Invoke-Expression'

httpd[Bearbeiten]

DocumentRoot is /usr/local/var/www.

The default ports have been set in /usr/local/etc/httpd/httpd.conf to 8080 and in /usr/local/etc/httpd/extra/httpd-ssl.conf to 8443 so that httpd can run without sudo.

To start httpd now and restart at login:

brew services start httpd

Or, if you don't want/need a background service you can just run:

/usr/local/opt/httpd/bin/httpd -D FOREGROUND


python@3.10[Bearbeiten]

Python is installed as

 /usr/local/bin/python3.10

Unversioned and major-versioned symlinks `python`, `python3`, `python-config`, `python3-config`, `pip`, `pip3`, etc. pointing to `python3.10`, `python3.10-config`, `pip3.10` etc., respectively, are installed into

 /usr/local/opt/python@3.10/libexec/bin

You can install Python packages with

 pip3.10 install <package>

They will install into the site-package directory

 /usr/local/lib/python3.10/site-packages

tkinter is no longer included with this formula, but it is available separately:

 brew install python-tk@3.10

If you do not need a specific version of Python, and always want Homebrew's `python3` in your PATH:

 brew install python3

See: https://docs.brew.sh/Homebrew-and-Python

nmap[Bearbeiten]

If using `ndiff` returns an error about not being able to import the ndiff module, try:

 chmod go-w /usr/local/Cellar

PHP und Apache mit Homebrew[Bearbeiten]

PHP[Bearbeiten]

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

Homebrew Rechte für Multiuser[Bearbeiten]

Jeder Admin soll Homebrew nutzen können:

#!/bin/sh
# Configure homebrew permissions to allow multiple users on MAC OSX.
# Any user from the admin group will be able to manage the homebrew and cask installation on the machine.

# allow admins to manage homebrew's local install directory
chgrp -R admin /usr/local
chmod -R g+w /usr/local

# allow admins to homebrew's local cache of formulae and source files
chgrp -R admin /Library/Caches/Homebrew
chmod -R g+w /Library/Caches/Homebrew

# if you are using cask then allow admins to manager cask install too
chgrp -R admin /opt/homebrew-cask
chmod -R g+w /opt/homebrew-cask