Skip to content

Commit 32d92f3

Browse files
aslilacpull[bot]
authored andcommitted
feat: install from homebrew in install.sh (#9414)
1 parent 638e03e commit 32d92f3

File tree

1 file changed

+40
-5
lines changed

1 file changed

+40
-5
lines changed

install.sh

+40-5
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ The detection method works as follows:
6767
- Debian, Ubuntu, Raspbian: install the deb package from GitHub.
6868
- Fedora, CentOS, RHEL, openSUSE: install the rpm package from GitHub.
6969
- Alpine: install the apk package from GitHub.
70-
- macOS: install the release from GitHub.
71-
- All others: install the release from GitHub.
70+
- macOS: if \`brew\` is available, install from the coder/coder Homebrew tap.
71+
- Otherwise, download from GitHub and install into \`--prefix\`.
7272
7373
We build releases on GitHub for amd64, armv7, and arm64 on Windows, Linux, and macOS.
7474
@@ -118,6 +118,26 @@ Run Coder:
118118
EOF
119119
}
120120

121+
echo_brew_postinstall() {
122+
if [ "${DRY_RUN-}" ]; then
123+
echo_dryrun_postinstall
124+
return
125+
fi
126+
127+
cath <<EOF
128+
brew formula has been installed.
129+
130+
To run a Coder server:
131+
132+
$ coder server
133+
134+
To connect to a Coder deployment:
135+
136+
$ coder login <deployment url>
137+
138+
EOF
139+
}
140+
121141
echo_systemd_postinstall() {
122142
if [ "${DRY_RUN-}" ]; then
123143
echo_dryrun_postinstall
@@ -303,9 +323,7 @@ main() {
303323
DISTRO=${DISTRO:-$(distro)}
304324

305325
case $DISTRO in
306-
# macOS uses the standalone installation for now.
307-
# Homebrew support is planned. See: https://github.com/coder/coder/issues/1925
308-
macos) install_standalone ;;
326+
darwin) install_macos ;;
309327
# The .deb and .rpm files are pulled from GitHub.
310328
debian) install_deb ;;
311329
fedora | opensuse) install_rpm ;;
@@ -408,6 +426,23 @@ with_terraform() {
408426
"$sh_c" cp "$CACHE_DIR/terraform" "$COPY_LOCATION"
409427
}
410428

429+
install_macos() {
430+
# If there is no `brew` binary available, just default to installing standalone
431+
if command_exists brew; then
432+
echoh "Installing v$VERSION of the coder formula from coder/coder."
433+
echoh
434+
435+
sh_c brew install coder/coder/coder
436+
437+
echo_brew_postinstall
438+
return
439+
fi
440+
441+
echoh "Homebrew is not available."
442+
echoh "Falling back to standalone installation."
443+
install_standalone
444+
}
445+
411446
install_deb() {
412447
echoh "Installing v$VERSION of the $ARCH deb package from GitHub."
413448
echoh

0 commit comments

Comments
 (0)