yonaskolb / Mint

A package manager that installs and runs executable Swift packages
MIT License
2.26k stars 122 forks source link

Option to specify install path? #220

Closed el-hoshino closed 6 months ago

el-hoshino commented 2 years ago

Since 0.17.0 the install path has been changed from /usr/local/bin to ~/.mint/bin, but it requires users to add this path to $PATH manually, which is very inconvenient in certain cases like trying to install mint with mint (swift run mint install yonaskolb/mint), especially when running it on CI. I think if there's an option to specify the install path, installing mint with mint would be much nicer 😄

yonaskolb commented 2 years ago

You can set the MINT_LINK_PATH env to any path you wish, though I'm not sure if that's forwarded on correctly by swift run. But if you already have the mint repo checked out, you should just be able to run make install

el-hoshino commented 2 years ago

Thanks for response! I tried setting MINT_LINK_PATH and found it working on my environment 🎉 (Intel i7 & Big Sur):

me@my-mac Dummy % type mint
mint not found
me@my-mac Dummy % git clone https://github.com/yonaskolb/Mint.git
Cloning into 'Mint'...
remote: Enumerating objects: 1993, done.
remote: Counting objects: 100% (77/77), done.
remote: Compressing objects: 100% (56/56), done.
remote: Total 1993 (delta 32), reused 46 (delta 19), pack-reused 1916
Receiving objects: 100% (1993/1993), 366.13 KiB | 2.00 MiB/s, done.
Resolving deltas: 100% (1135/1135), done.
me@my-mac Dummy % cd Mint
me@my-mac Mint % export MINT_LINK_PATH="/usr/local/bin" && swift run mint install yonaskolb/mint
...
🌱 Linked mint 0.17.1 to /usr/local/bin, replacing version 0.17.0
me@my-mac Mint % type mint
mint is /usr/local/bin/mint
me@my-mac Mint % cd ../
me@my-mac Dummy % cat Mintfile  
yonaskolb/mint
el-hoshino/hanako
me@my-mac Dummy % mint bootstrap
🌱 Finding latest version of mint
🌱 Finding latest version of hanako
🌱 Cloning hanako v1.0.4
🌱 Resolving package
🌱 Building package
🌱 Installed hanako v1.0.4
🌱 Installed 1/2 packages
me@my-mac Dummy % mint run hanako
🌱 Finding latest version of hanako
🌱 Running hanako v1.0.4...
Generated string: Fp8dOs2aRz
Result has been copied to your clipboard, you can use cmd + v to paste it.

me@my-mac Dummy % unset MINT_LINK_PATH
me@my-mac Dummy % mint run hanako
🌱 Finding latest version of hanako
🌱 Running hanako v1.0.4...
Generated string: T05TW7yYMW
Result has been copied to your clipboard, you can use cmd + v to paste it.

Should I close this issue or keep it open for someone to check if it also works on M1 environment?

marinofelipe commented 6 months ago

for someone to check if it also works on M1 environment?

More than 2 years later, but it works fine on M1. Also nice that the README mentions it 🙏