OpenBSD Handbook

    Theme
    • Part I. Install & Configure
      • Introduction to OpenBSD
      • Installing OpenBSD
      • The X Window System
      • Networking on OpenBSD
      • System Configuration
      • OpenBSD Basics
      • Managing Software: Packages and Ports
    • Part II. Daily Operations
      • OpenBSD Desktop Environments
      • Multimedia
      • Printing
      • Linux Compatibility
      • Windows Compatibility
      • Games
    • Part III. System Administration
      • Virtualization
      • Storage and File Systems
      • Updating and Upgrading
      • Localization
      • The OpenBSD Boot Process
      • Security
    • Part IV. Networking & Daemons
      • Services
        • Database
          • MariaDB
          • PostgreSQL
          • Redis
          • memcached
        • Directory
          • YP (NIS)
          • LDAP
        • File
          • NFS
          • Samba
        • FTP Services
          • ftpd
          • ProFTPD
          • vsftpd
          • Pure-FTPd
          • TFTP
        • Mail
          • OpenSMTPD Mail Server
          • Dovecot IMAP and POP3 Server
          • Postfix
          • Exim
          • Rspamd
        • Name
          • Unbound DNS Resolver
          • NSD Authoritative DNS Server
          • BIND DNS Server
        • Networking
          • OpenBGPD
          • rad
          • DHCP on OpenBSD
          • slaacd
        • Web
          • Apache HTTP Server
          • nginx Web Server
          • OpenBSD httpd Web Server
          • relayd Reverse Proxy
        • Logging
          • syslogd
        • Monitoring
          • SNMP
        • Remote Access
          • Audit OpenSSH
          • OpenSSH Server
        • File Synchronization
          • rsync
        • Messaging
          • RabbitMQ Message Broker
        • Time
          • NTP Time Synchronization
        • Load Balancing
          • Build Redundant Load-Balanced Gateways
          • Load Balance Services with NAT or DSR
          • Build an HA HTTPS Load Balancer
      • PF
        • pfctl cheat sheet
        • PF Anchors
        • PF Filter Rules
        • PF Forwarding
        • PF Lists and Macros
        • PF Load Balancing
        • PF Logging
        • PF NAT
        • PF Options
        • PF Policies
        • PF Shortcuts
        • PF Tables
      • Advanced Networking
        • High Availability and State Replication
        • Multi-WAN and Policy-Based Routing
        • VPN and Cryptographic Tunneling
        • Classic and Lightweight Tunnels
        • IPv6 at Scale
        • QoS and Traffic Shaping
        • MPLS and Label Distribution
        • Network Services at Scale
        • Virtualization and Host Networking
        • Large-Scale L2 and L3 Design
        • Telemetry, Logging, and Flow Export
        • Hardening and Operational Safety
        • Reference Architectures
        • Troubleshooting Playbooks
      • Serial Communication
    • Part V. Miscellaneous
      • Virtualization Cheat Sheet
      • OpenBSD Cheatsheet
      • How-to Guides
        • Installation and First Boot
          • Complete the First 30 Minutes After Installation
          • Check Hardware Compatibility Before Installing
          • Bootstrap Wi-Fi Firmware Without Ethernet
          • Run OpenBSD as a Virtual Machine Guest
          • Install OpenBSD on a VPS or Cloud Server
          • Install OpenBSD with Full-Disk Encryption
          • Dual-Boot OpenBSD on a UEFI System
          • Automate OpenBSD Installation with Autoinstall and PXE
        • Desktops and Laptops
          • Set Up OpenBSD as a Laptop or Workstation
          • Configure Laptop Power Management
          • Troubleshoot Web Browsers on OpenBSD
          • Use Plan 9 Tools on OpenBSD
          • Build a Minimal Desktop with suckless Tools
          • Install Z shell (zsh)
        • Networking and Remote Access
          • Create an Administrator Account with doas and SSH Keys
          • Configure Secure Remote Access with OpenSSH
          • Use FIDO Security Keys with OpenSSH
          • Configure Wi-Fi Roaming and Wired Failover
          • Troubleshoot PF, NAT, and Routing
          • Route Multiple VLANs with PF
          • Configure a Road-Warrior WireGuard VPN
          • Route IPv6 Networks without NAT
          • Test OpenBGPD with Two Providers
          • Unlock an Internal Service with an SSH Key
          • Build a Simple Router and Firewall
        • Servers and Services
          • Set Up WordPress on OpenBSD
          • Build a Mail Server with OpenSMTPD, Dovecot, and Rspamd
        • Security, Maintenance and Recovery
          • Establish a Conservative Security Baseline
          • Recover Access and Reset the Root Password
          • Collect OpenBSD Diagnostic Evidence
          • Troubleshoot Package Installation and Update Failures
          • Schedule Recurring Maintenance
          • Monitor an OpenBSD System
          • Back Up and Restore an OpenBSD System
          • Configure softraid RAID1
          • Recover an OpenBSD System That Does Not Boot
        • Building, Automation and Virtual Machines
          • Manage OpenBSD with Ansible
          • Build Third-Party Software from Ports
          • Build OpenBSD from Source
          • Plan a Docker Workload Migration to OpenBSD
      • OpenBSD for Linux Users
      • OpenBSD for FreeBSD Users
      • OpenBSD for macOS Users
    • OpenBSD FAQ
    • OpenBSD Architectures
      • OpenBSD Package Search
        • Shells
        • Privilege escalation: doas (instead of macOS sudo)
        • Software management
          • Installing and removing packages
          • Updating (same release)
          • Upgrading (to a new release)
        • Networking
          • Interface configuration with hostname.if
          • Hostname
          • Default gateway
          • DNS resolvers
        • Daemons and startup
        • Common equivalents

        OpenBSD for macOS Users

        This guide maps common macOS administration tasks to OpenBSD tools and configuration files. It assumes an installed OpenBSD 8.0 system with command-line access.

        Shells #

        On OpenBSD, the default shell for both root and regular users is the Korn shell, ksh(1) . On modern macOS systems, new user accounts default to zsh. OpenBSD’s ksh(1) implements a superset of the traditional Bourne shell language.

        Alternative shells (e.g., Bash, Zsh) are available as packages; see pkg_add(1) and chsh(1) .

        Recommendation: Do not change root’s shell to a package-provided shell. Non-base shells live under /usr/local/bin, which may be unavailable in a limited-recovery scenario. The base ksh(1) resides in /bin.

        # Install common alternative shells (from a regular account via doas(1))
        doas pkg_add bash zsh  # Install Bash and Zsh
        chsh -s /usr/local/bin/zsh  # Change your login shell to Zsh
        

        Privilege escalation: doas (instead of macOS sudo) #

        OpenBSD provides doas(1) in the base system for privilege escalation (macOS ships sudo). Configure OpenBSD’s tool via doas.conf(5) . A documented example exists in /etc/examples/.

        For first-time setup, use the root-shell procedure in Create an Administrative Account . Preserve and review any existing policy before changing it.

        By default, each command prompts for a password. To cache authentication similarly to many sudo configurations, add persist:

        permit persist :wheel
        

        A sudo package is available if required; see sudo(8).

        Software management #

        Unlike macOS, where third-party package managers such as Homebrew or MacPorts are common, OpenBSD provides an official, integrated binary package system. Prefer prebuilt packages; see packages(7) . Building from ports is documented in ports(7) .

        Installing and removing packages #

        Install prebuilt packages with pkg_add(1) :

        doas pkg_add nginx  # Install Nginx
        

        Remove packages with pkg_delete(1) :

        doas pkg_delete nginx  # Remove Nginx
        

        List installed packages with pkg_info(1) :

        pkg_info  # List installed packages
        

        Updating (same release) #

        OpenBSD ships binary patches for the base system via syspatch(8) . This is broadly analogous to macOS Software Update for the operating system, not third-party software.

        doas syspatch -c  # Show available base patches
        doas syspatch     # Apply base patches (reboot if required)
        

        Update installed packages to the latest for your release:

        doas pkg_add -Uu  # Upgrade all packages within the current release
        

        Upgrading (to a new release) #

        Use sysupgrade(8) to fetch and perform a release upgrade. After the reboot, complete any configuration merges with sysmerge(8) if prompted, then update packages.

        doas sysupgrade  # Upgrade base to the next OpenBSD release
        doas pkg_add -Uu # Update packages after the base upgrade
        

        Networking #

        On macOS, interfaces often appear as en0, en1, and so on. OpenBSD names interfaces by driver, for example em0 (Intel), re0 (Realtek), and bge0 (Broadcom). See ifconfig(8) for details.

        Interface configuration with hostname.if #

        Per-interface configuration lives in hostname.if(5) , where if is the interface name (e.g., /etc/hostname.em0). This replaces macOS command-line tools such as networksetup and scutil for persistent settings.

        Static IPv4:

        inet 10.0.0.100 255.255.255.0
        

        Static IPv6:

        inet6 2001:db8:6000:9344::154 64
        

        DHCP:

        inet autoconf
        

        Apply configuration from files using netstart(8) :

        doas sh /etc/netstart      # Reload all interfaces
        doas sh /etc/netstart em0  # Reload a single interface
        

        Temporary, runtime changes can be made with ifconfig(8) :

        doas ifconfig em0 10.0.0.100 255.255.255.0  # Set a temporary IPv4 address
        

        Hostname #

        Set the system’s fully qualified domain name in myname(5) (/etc/myname). This replaces scutil --set HostName on macOS.

        host.example.com
        

        At boot, the system reads its hostname from /etc/myname. To change it now, use hostname(1) :

        doas hostname host.example.com
        

        Running sh /etc/netstart reloads interfaces and routes; it does not change the hostname.

        Default gateway #

        Set the default gateway(s) in mygate(5) (/etc/mygate). One address per line; the first of each family is used.

        10.0.0.1
        2001:db8:6000:9344::1
        

        Reload networking with sh /etc/netstart.

        DNS resolvers #

        resolvd(8) combines dynamic DNS proposals with user-edited lines in /etc/resolv.conf. Do not make that file immutable. Configure DHCP/SLAAC proposal policy when static DNS must take precedence.

        Configure resolvers in resolv.conf(5) , rather than using scutil --dns or the System Settings UI:

        nameserver 192.0.2.1
        lookup file bind
        

        Reload networking with sh /etc/netstart.

        Daemons and startup #

        macOS uses launchd and launchctl for service management. OpenBSD uses the traditional BSD init and rc system; see init(8) , rc(8) , and rc.conf(8) . System defaults are in /etc/rc.conf. Do not edit it directly; override and localize settings in /etc/rc.conf.local.

        Control and enable daemons with rcctl(8) . For example, to manage the base web server, httpd(8) :

        doas rcctl start httpd    # Start httpd now (analogous to `launchctl kickstart`)
        doas rcctl stop httpd     # Stop httpd (analogous to unloading a launchd service)
        doas rcctl reload httpd   # Reload httpd configuration
        doas rcctl enable httpd   # Enable start at boot (persistent)
        doas rcctl disable httpd  # Disable start at boot
        

        Common equivalents #

        Task (macOS)OpenBSD tool or filePurpose
        brew install nginx / port install nginxpkg_add nginxInstall a package from the repository
        brew upgrade / port upgrade outdatedpkg_add -UuUpgrade all packages in the release
        softwareupdate -iasyspatchApply base system security/bug patches
        Major macOS upgrade (Installer / MDM)sysupgradeUpgrade to the next OpenBSD release
        launchctl kickstart gui/UID/labelrcctl start svcStart a service
        launchctl bootout system/labelrcctl stop svcStop a service
        launchctl enable system/labelrcctl enable svcEnable service at boot
        scutil --set HostName host.example.com/etc/mynameSet system hostname
        networksetup -setdhcp Wi-Fi/etc/hostname.em0 with inet autoconfConfigure an interface for DHCP
        View DNS: scutil --dns/etc/resolv.confDNS resolver configuration

        For further details, consult the referenced manual pages on this site.

        Report a bug
        • Shells
        • Privilege escalation: doas (instead of macOS sudo)
        • Software management
          • Installing and removing packages
          • Updating (same release)
          • Upgrading (to a new release)
        • Networking
          • Interface configuration with hostname.if
          • Hostname
          • Default gateway
          • DNS resolvers
        • Daemons and startup
        • Common equivalents