Forked from fardjad/how-to-start-colima-automatically-on-macos.md
Last active
August 28, 2023 17:13
Revisions
-
bobziuchkovski revised this gist
Aug 28, 2023 . 1 changed file with 5 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,9 @@ ```bash # Create launcher script cat <<-EOF | sudo tee /usr/local/bin/colima-start-fg #!/bin/bash export PATH="/opt/homebrew/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" function shutdown() { colima stop @@ -31,12 +28,10 @@ tail -f /dev/null & wait \$! EOF # Mark script executable sudo chmod +x /usr/local/bin/colima-start-fg # Create launch agent cat > $HOME/Library/LaunchAgents/com.github.abiosoft.colima.plist <<-EOF <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> @@ -54,5 +49,6 @@ cat > $HOME/Library/LaunchAgents/com.github.abiosoft.colima.plist <<-EOF </plist> EOF # Load the launch agent launchctl load -w $HOME/Library/LaunchAgents/com.github.abiosoft.colima.plist ``` -
fardjad revised this gist
Jul 8, 2023 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,6 @@ function shutdown() { } trap shutdown SIGTERM trap shutdown SIGINT # wait until colima is running -
fardjad revised this gist
Mar 20, 2023 . 1 changed file with 11 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,8 +6,6 @@ cat <<-EOF | sudo tee /usr/local/bin/colima-start-fg #!/bin/bash export PATH="/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" function shutdown() { @@ -19,7 +17,17 @@ trap shutdown SIGTERM trap shutdown SIGKILL trap shutdown SIGINT # wait until colima is running while true; do colima status &>/dev/null if [[ \$? -eq 0 ]]; then break; fi colima start sleep 5 done tail -f /dev/null & wait \$! EOF -
fardjad revised this gist
Mar 20, 2023 . 1 changed file with 2 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,15 +1,6 @@ ## Steps 1. Create an executable script to run in foreground and manage colima: ```bash cat <<-EOF | sudo tee /usr/local/bin/colima-start-fg @@ -36,7 +27,7 @@ EOF sudo chmod +x /usr/local/bin/colima-start-fg ``` 2. Create a launchd agent to run **colima** automatically: ```bash cat > $HOME/Library/LaunchAgents/com.github.abiosoft.colima.plist <<-EOF -
fardjad revised this gist
Apr 3, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -30,7 +30,7 @@ trap shutdown SIGINT colima start tail -f /dev/null & wait \$! EOF sudo chmod +x /usr/local/bin/colima-start-fg -
fardjad revised this gist
Apr 3, 2022 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ 1. Allow `colima start` to run without password: ```bash cat <<-EOF | sudo tee /private/etc/sudoers.d/colima %admin ALL=NOPASSWD: /bin/rm -rf /var/run/docker.sock %admin ALL=NOPASSWD: /bin/ln -s $HOME/.colima/docker.sock /var/run/docker.sock EOF @@ -12,7 +12,7 @@ EOF 2. Create an executable script to run in foreground and manage colima: ```bash cat <<-EOF | sudo tee /usr/local/bin/colima-start-fg #!/bin/bash set -e -
fardjad created this gist
Apr 3, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,60 @@ ## Steps 1. Allow `colima start` to run without password: ```bash cat <-EOF | sudo tee /private/etc/sudoers.d/colima %admin ALL=NOPASSWD: /bin/rm -rf /var/run/docker.sock %admin ALL=NOPASSWD: /bin/ln -s $HOME/.colima/docker.sock /var/run/docker.sock EOF ``` 2. Create an executable script to run in foreground and manage colima: ```bash cat <-EOF | sudo tee /usr/local/bin/colima-start-fg #!/bin/bash set -e export PATH="/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" function shutdown() { colima stop exit 0 } trap shutdown SIGTERM trap shutdown SIGKILL trap shutdown SIGINT colima start tail -f /dev/null & wait $! EOF sudo chmod +x /usr/local/bin/colima-start-fg ``` 3. Create a launchd agent to run **colima** automatically: ```bash cat > $HOME/Library/LaunchAgents/com.github.abiosoft.colima.plist <<-EOF <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>com.github.abiosoft.colima</string> <key>Program</key> <string>/usr/local/bin/colima-start-fg</string> <key>RunAtLoad</key> <true/> <key>KeepAlive</key> <false/> </dict> </plist> EOF launchctl load -w $HOME/Library/LaunchAgents/com.github.abiosoft.colima.plist ```