Skip to content

Commit 9fe46c9

Browse files
committed
feat: install from homebrew in install.sh
1 parent 16ef97a commit 9fe46c9

File tree

1 file changed

+38
-5
lines changed

1 file changed

+38
-5
lines changed

install.sh

Lines changed: 38 additions & 5 deletions
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+
macos) install_macos ;;
309327
# The .deb and .rpm files are pulled from GitHub.
310328
debian) install_deb ;;
311329
fedora | opensuse) install_rpm ;;
@@ -408,6 +426,21 @@ 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 [ ! -fx $(which brew) ]; then
432+
install_standalone
433+
return
434+
fi
435+
436+
echoh "Installing v$VERSION of the coder formula from coder/coder."
437+
echoh
438+
439+
sh_c brew install coder/coder/coder
440+
441+
echo_brew_postinstall
442+
}
443+
411444
install_deb() {
412445
echoh "Installing v$VERSION of the $ARCH deb package from GitHub."
413446
echoh

0 commit comments

Comments
 (0)