twostraws / Ignite

A static site generator for Swift developers.
MIT License
1.71k stars 94 forks source link

Ignite command not found #124

Closed henryhudson closed 2 weeks ago

henryhudson commented 1 month ago

Hi all,

I tried following the install instructions but can't seem to get it to work properly.

when I install and try run the ignite new function I get the error that there is no ignite command.

code below

~:$ cd Ignite
~/Ignite:$ ls
CODE_OF_CONDUCT.md      Package.resolved        Sources
LICENSE                 Package.swift           Tests
Makefile                README.md               images
~/Ignite:$ sudo make && install
Password:
Building the Ignite command-line tool...

Building for production...
[1/1] Write swift-version--58304C5D6DBC2206.txt
Build of product 'IgniteCLI' complete! (0.22s)
usage: install [-bCcpSsUv] [-f flags] [-g group] [-m mode] [-o owner]
               [-M log] [-D dest] [-h hash] [-T tags]
               [-B suffix] [-l linkflags] [-N dbdir]
               file1 file2
       install [-bCcpSsUv] [-f flags] [-g group] [-m mode] [-o owner]
               [-M log] [-D dest] [-h hash] [-T tags]
               [-B suffix] [-l linkflags] [-N dbdir]
               file1 ... fileN directory
       install -dU [-vU] [-g group] [-m mode] [-N dbdir] [-o owner]
               [-M log] [-D dest] [-h hash] [-T tags]
               directory ...
~/Ignite:$ ignite new examplesite
zsh: command not found: ignite
~/Ignite:$ sudo make install
Installing the Ignite command-line tool...

❌ Unable to create install directory `/usr/local/bin`. You might need to run `sudo make`

make: *** [install] Error 126
~/Ignite:$

I have tried deleting all the files and reinstalling but it still doesn't work. if anyone has any ideas why I would be very grateful.

vdhamer commented 1 month ago

Not sure what's going wrong on your side. Here is the relevant directory structure of a working ignite setup:

peter@Peters-Mac-Studio-2 local % pwd
/usr/local
peter@Peters-Mac-Studio-2 local % ls -al
total 0
drwxr-xr-x   3 root  wheel   96 Sep 17 22:21 .
drwxr-xr-x@ 11 root  wheel  352 Sep  5 22:54 ..
drwxr-xr-x@ 16 root  wheel  512 Aug 21 23:55 bin
peter@Peters-Mac-Studio-2 local % ls -al bin/ignite 
-rwxr-xr-x  1 root  wheel  1440264 Aug 21 23:55 bin/ignite
peter@Peters-Mac-Studio-2 local % 

The exact file size of ignite can be a bit different per commit. Try checking the privilege of /usr/local/bin against the above. Or if it doesn't exist (it should), you will have to create it. See link below. /usr/local/bin also needs to be in the path. It looks like your account is allowed to run sudo. And just to be sure, you are running on a MacOS (and not Swift on Linux)?

https://stackoverflow.com/questions/25654731/usr-local-bin-no-such-file-or-directory

henryhudson commented 1 month ago

Hi Vdhamer

to confirm I am on MacOS Sequoia

maybe its a permissions / privilege issue as you say. still getting the same error. I tried installing to /user/local but it says im not allowed.

~/ignite:$ ls
CODE_OF_CONDUCT.md      Package.resolved        Sources
LICENSE                 Package.swift           Tests
Makefile                README.md               images
~/ignite:$ pwd
/Users/henryhudson/ignite
~/ignite:$ ../
~:$ ../
/Users:$ ../
/:$ ls
Applications    Volumes         etc             sbin
Library         bin             home            tmp
System          cores           opt             usr
Users           dev             private         var
/:$ cd usr/local
/usr/local:$ ls
bin     texlive
/usr/local:$ git clone https://github.com/twostraws/Ignite
fatal: could not create work tree dir 'Ignite': Permission denied
/usr/local:$ ls -la
total 8
drwxr-xr-x   4 root  wheel  128 26 Sep 11:45 .
drwxr-xr-x@ 11 root  wheel  352  5 Sep 21:54 ..
-rwxr-xr-x   1 root  wheel  116 29 Jul  2021 bin
drwxr-xr-x   4 root  wheel  128  6 Jul  2021 texlive
/usr/local:$ ls -al bin/ignite
ls: bin/ignite: Not a directory
/usr/local:$ cd ~
~:$ cd IGNITE
~/IGNITE:$ sudo make install
Installing the Ignite command-line tool...

❌ Unable to create install directory `/usr/local/bin`. You might need to run `sudo make`

make: *** [install] Error 126
~/IGNITE:$ sudo make
Building the Ignite command-line tool...

Building for production...
[1/1] Write swift-version--58304C5D6DBC2206.txt
Build of product 'IgniteCLI' complete! (0.23s)
~/IGNITE:$ make install
Installing the Ignite command-line tool...

❌ Unable to create install directory `/usr/local/bin`. You might need to run `sudo make`

make: *** [install] Error 126
~/IGNITE:$ sudo make install
Installing the Ignite command-line tool...

❌ Unable to create install directory `/usr/local/bin`. You might need to run `sudo make`

make: *** [install] Error 126
~/IGNITE:$

very odd its not working...

vdhamer commented 1 month ago

very odd its not working...

Try disabling the App Sandbox setting in the .entitlements file. The MacOS sandbox gives an extra layer of access control on top of classic Unix user/group/world privileges. It's to prevent rogue apps running under your account from reading/writing stuff they shouldn't be allowed to see or even change.

@henryhudson

henryhudson commented 2 weeks ago

I can't seem to find the app sandbox? I have opened the ignite file in Xcode is that where you find it? with my other projects the symbol is like the App Store then I click sign in and capabilities but doesn't seem to work when I open the project folder. I have been trying to do everything by the command line.

vdhamer commented 2 weeks ago

I can't seem to find the app sandbox? [..] I have been trying to do everything by the command line.

In a terminal window a regular app shows up as: /Users/<user>/Library/Containers/com.vdHamer.Photo-Club-Hub-HTML/Data where you obviously need to use your own bundle name, and Data is for the folders for reading and writing data.

In the Finder com.vdHamer.Photo-Club-Hub-HTML is shown as a more user friendlyPhoto Club Hub HTML.

You can also find the path programmatically:

let buildDirectory: String = NSHomeDirectory() // app's home directory for a sandboxed MacOS app
print(buildDirectory)

All this doesn't apply if you just use the sample Ignite project whereby Ignite is an executable package.