doas icon indicating copy to clipboard operation
doas copied to clipboard

Improve macOS install instructions

Open Neved4 opened this issue 1 year ago • 7 comments

Running xcode-select --install doesn't seem enough, since it fails to locate yacc:

$ yacc
xcode-select: Failed to locate 'yacc', requesting installation of command line developer tools.

$ xcode-select -p    
/Library/Developer/CommandLineTools

Users of Xcode.app, provided that it's installed, can just:

sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer

Otherwise, some additional steps are required, we could add those to the macOS install:

ln -s /opt/homebrew/bin/byacc /opt/homebrew/bin/yacc
export PATH=/opt/homebrew/bin/yacc:$PATH"
make all
sudo make install

Took those and packaged doas in my own formula: Neved4/tap/doas. Very basic and still in the works, got stuck on this one:

Error: Unwanted system libraries:
    /lib/x86_64-linux-gnu/libpam.so.0
    /lib/x86_64-linux-gnu/libpam_misc.so.0

Probably we need to patch our Makefile at the recipe stage, since we need to pull linux-pam anyways or security/pam_appl.h will be missing.

When it's done you could clone my formula and upload it to your own homebrew-tap repo, so brew users can just run brew install slicer69/tap/doas.

Cheers! 🤍

Neved4 avatar Aug 22 '24 21:08 Neved4

I also planned to make a formula for doas but you did it first, so go ahead it's going to be so much better for everyone

maxchrr avatar Aug 23 '24 11:08 maxchrr

I haven't written any formula or build instructions for doas on macOS as we don't actively support the platform.

Someone else sent in the build instructions for doas on macOS which appear in our README file. If those no longer work I can remove them.

slicer69 avatar Aug 23 '24 11:08 slicer69

They work they just seem to need additional steps.

Neved4 avatar Aug 23 '24 13:08 Neved4

If I'm reading your report correctly all we should need to add to the instructions are this line:

 sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer

Assuming that's right, I'll just that this to our README under the section for macOS.

slicer69 avatar Aug 23 '24 22:08 slicer69

@slicer69 that'd make compilation to install the full 12.5 GB Xcode.app instead of rely on the baseline 2 GB.

Here are two scenarios:

  1. Xcode.app / iOS / Swift devs: likely already installed, so they can build doas as-is if they have it selected. All they'd need is verify it with:

    $ xcode-select --path
    /Applications/Xcode.app/Contents/Developer
    
  2. CommandLineTools users: most general devs are probably using them already:

    $ xcode-select --path
    /Library/Developer/CommandLineTools
    

    This is the most frequent scenario. Homebrew and MacPorts users will already have CommandLineTools installed, and most others presumably have them out of necessity.

    To build doas, we have to install and symlink byacc:

    brew install byacc
    
    ln -s /opt/homebrew/bin/byacc /opt/homebrew/bin/yacc
    export PATH="/opt/homebrew/bin/yacc:$PATH"
    
    cd doas
    make all
    sudo make install
    

    This is because yacc came with CommandLineTools before, that made the current install steps just work. yacc no longer ships in recent versions, only providing a skeleton file:

    $ locate yacc
    /Library/Developer/CommandLineTools/usr/share/bison/yacc.c
    

CommandLineTools with Homebrew is the lowest common denominator.
Others are also stumbling upon this issue and adding patches to detect when yacc is missing.

To make things work we could either:

  • Add this detection at the Makefile level.
    That'd allow to automatically detect and workaround both previous and recent macOS versions.
  • Add the instructions to our README.md, wait for Apple to re-add yacc later down the line.
    Seems easier to just add the steps that users would follow.

Can make a PR with the changes if you'd like. Cheers!

Neved4 avatar Aug 24 '24 09:08 Neved4

Yes, please, create a pull request with the necessary changes to the README file. This seems like the easiest approach. I'll merge it in.

slicer69 avatar Aug 24 '24 12:08 slicer69

Will do! 🤍

Neved4 avatar Aug 24 '24 14:08 Neved4