Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apple M1 support #2

Closed
tizot opened this issue Dec 20, 2022 · 3 comments
Closed

Apple M1 support #2

tizot opened this issue Dec 20, 2022 · 3 comments
Assignees
Labels

Comments

@tizot
Copy link

tizot commented Dec 20, 2022

Hi,

The workflow unfortunately does not work on Apple MacBook M1.
When the script is executed, I see the message "Bad CPU type in executable". I guess this is due to the fact that it is compiled to a binary with Dart now.

@techouse
Copy link
Owner

techouse commented Dec 22, 2022

Correct that is a known limitation of the binary compilation process.

The exe subcommand has some known limitations:

No cross-compilation support (issue 28617)
The compiler can create machine code only for the operating system on which you’re compiling. To create executables for > macOS, Windows, and Linux, you need to run the compiler three times. You can also use a continuous integration (CI) > provider that supports all three operating systems.

Unfortunately, I do not own an Apple M1 yet, therefore the compiled binary is x86_64.

➜  tailwindcss-docs-alfred-workflow git:(master) file build/dist/docs 
build/dist/docs: Mach-O 64-bit executable x86_64

You have 2 options to run this on your Apple M1:

Option A: Use Rosetta

softwareupdate --install-rosetta

Option B: Compile the workflow from scratch on your own machine.

This one is a bit more involved, but all you have to do is.

# install the Dart SDK
brew tap dart-lang/dart
brew install dart

# clone the repo
git clone https://github.com/techouse/alfred-tailwindcss-docs
cd alfred-tailwindcss-docs

# edit the env
cp .env.example .env
vim .env

# generate all the environment-dependent files
make code_gen

# compile the app
make compile

@techouse techouse added the arm64 label Dec 22, 2022
@techouse techouse reopened this Dec 22, 2022
@techouse
Copy link
Owner

I'll add a wrapper script to detect the architecture and run it as required.

@techouse
Copy link
Owner

techouse commented Dec 22, 2022

Right, v2.1.10 is now executed as

arch -x86_64 ./docs -q "{query}"

That should force the OS to run it as such.

@techouse techouse self-assigned this Dec 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants