Initial steps after fresh macOS installation

Install basic set of applications

  • Homebrew, bash, tmux, htop
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
$ /opt/homebrew/bin/brew install bash tmux htop
  • asitop
$ brew install pipx
$ pipx ensurepath
$ pipx install --suffix=-m5 'git+https://github.com/ProducerGuy/asitop.git'

Change default login shell to bash

macOS is shipped with old Bash 3.2, so install newer Bash using Homebrew - see above

  • add Homebrew bash to trusted shells
$ echo /opt/homebrew/bin/bash | sudo tee -a /etc/shells
  • set Homebrew bash as default login shell
$ chsh -s /opt/homebrew/bin/bash

Native Apple containers

container is a tool that you can use to create and run Linux containers as lightweight virtual machines on your Mac. It's written in Swift, and optimized for Apple silicon. container is supported on macOS 26, since it takes advantage of new features and enhancements to virtualization and networking in this release. Available on https://github.com/apple/container.

  • install Apple containers using Homebrew and start it
$ brew install container
$ container system start
Verifying apiserver is running...                                                                                       
No default kernel configured.                                                                                           
Install the recommended default kernel from [https://github.com/kata-containers/kata-containers/releases/download/3.17.0
/kata-static-3.17.0-arm64.tar.xz]? [Y/n]: Y                                                                             
Installing kernel...                                                                                                    
$
  • pull ubuntu OCI image
$ container images pull ubuntu
...
$ container images list
NAME    TAG     DIGEST
ubuntu  latest  9cbed754112939e914291337...
$
  • create and run Ubuntu container
$ container run --name my-ubuntu -t -i ubuntu bash
#
  • deploy Apache+PHP and couple of other useful packages in Ubuntu container
# apt update
# apt install net-tools iputils-ping dnsutils ssh apache2 php vim less
# apachectl start
# vim /var/www/html/info.php
  • exit stops the container
# exit
$ container list --all
ID         IMAGE                            OS     ARCH   STATE    ADDR
my-ubuntu  docker.io/library/ubuntu:latest  linux  arm64  stopped
$
  • start the stopped container and open bash prompt
$ container start my-ubuntu
$ container exec -t -i my-ubuntu bash
# apachectl start

Enable/disable root user

Use Directory Utility to enable or disable root user.

  • From the menu bar in the Finder, choose Go > Go to Folder.
  • Type or paste /System/Library/CoreServices/Applications/, then press Return.
  • Open Directory Utility from the window that opens.

To enable or disable the root user

  • In the Directory Utility window, click the locklock icon, then enter an administrator name and password.
  • To enable the root user, choose Edit > Enable Root User from the menu bar. Then enter the password that you want to use. You can then log in as the root user.
  • To disable the root user, choose Edit > Disable Root User.

To change the root password

  • In the Directory Utility window, click the locklock icon, then enter an administrator name and password.
  • From the menu bar, choose Edit > Change Root Password.

Apache + PHP

macOS ships with Apache by default. PHP was bundled with macOS in versions 10 and 11, but is not included in versions since macOS 12 (Monterey). Installation on recent versions either requires using packages from third-party sources, or compilation from source.

Install PHP with Homebrew packaging manager

$ brew install php
...
To enable PHP in Apache add the following to httpd.conf and restart Apache:                                             
    LoadModule php_module /opt/homebrew/opt/php/lib/httpd/modules/libphp.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:
    /opt/homebrew/etc/php/8.4/ 

To 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:
  /opt/homebrew/opt/php/sbin/php-fpm --nodaemonize
...
$ 

Sign PHP module

On macOS Monterey and later versions, code signing is mandatory for all modules integrated with system services like Apache. This requirement ensures that only verified and trusted code can run on your system. When installing the PHP module via Homebrew, it remains unsigned by default, which prevents Apache from loading it.

To resolve this issue, you must manually sign the PHP module using the codesign utility. This process requires the creation of a custom Certificate Authority and a code signing certificate within the Keychain Access tool on macOS. Without this, you will encounter errors during the module loading process, blocking the execution of the module.

After setting up the necessary certificates, you can sign the PHP module and ensure it is accepted by the system’s security protocols. This step is crucial every time the module is updated or reinstalled via Homebrew, to maintain compatibility and security.

  • create a Certificate Authority for code signing using Keychain Access as described here
  • create code signing certificate using Keychain Access as described here
  • sign homebrew PHP module as described here
  • the signing needs to be done after each OS upgrade
$ codesign --sign "dambi" --force --keychain ~/Library/Keychains/login.keychain-db /opt/homebrew/opt/php/lib/httpd/modules/libphp.so
$ codesign -d -vvv /opt/homebrew/Cellar/php/8.5.11/lib/httpd/modules/libphp.so
...
Signature size=2825
Authority=dambi
Authority=dambi's CA
Signed Time=2. 10. 2026 at 9:02:41
...

Configure Apache to use PHP

$ sudo cp /private/etc/apache2/other/php7.conf /private/etc/apache2/other/php8.conf
$ sudo vim /private/etc/apache2/other/php8.conf
$ cat /private/etc/apache2/other/php8.conf
LoadModule php_module /opt/homebrew/opt/php/lib/httpd/modules/libphp.so "dambi"
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

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

<IfModule dir_module>
        DirectoryIndex index.html index.php
</IfModule>
$ sudo apachectl start

Tune Apache and PHP for DokuWiki

  • enable .htaccess - Locate the section labeled <Directory “/Library/WebServer/Documents”>. In that section, change the AllowOverride None entry to AllowOverride All.
$ sudo vim /etc/apache2/httpd.conf
$ cat /etc/apache2/httpd.conf
...
DocumentRoot "/Library/WebServer/Documents"
<Directory "/Library/WebServer/Documents">
...
AllowOverride All
...
</Directory>
$
  • workaround “Allocation of JIT memory failed, PCRE JIT will be disabled” error
$ vim /opt/homebrew/etc/php/8.4/php.ini
$ cat /opt/homebrew/etc/php/8.4/php.ini
...
pcre.jit=0
...
$ apachectl restart

Thunderbird

Bigger font size

  • Menu app icon > Options/Preferences > General
  • Scroll down to the very bottom
  • click on 'Config Editor' button to open 'about:config'
  • Accept the risk.
  • In search type: pixels
  • Look for this line: layout.css.devPixelsPerPx
  • Double left click on that line to open the 'Enter string Value' box so you can edit the Value. The default value will be a negative number: -1.0
  • Enter a new positive number: 1.3 seems to work for me, then click on OK.

The effect is immediate, so you can modify that number until it looks ok for you. Image below as guide.

notes/macos_tips.txt · Last modified: by 127.0.0.1
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0