Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
supabase_cli/install at develop · TFSebben/supabase_cli · GitHub
Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
See all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
TFSebben
supabase_cli
Repository navigation
Code
Pull requests
Projects
Security and quality
Insights
More
items
Files
Expand file tree
develop
Breadcrumbs
supabase_cli
/
install
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
executable file
·
332 lines (279 loc) · 8.12 KB
develop
Breadcrumbs
supabase_cli
/
install
Copy path
Top
File metadata and controls
Code
Blame
executable file
·
332 lines (279 loc) · 8.12 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
#!
/usr/bin/env bash
set
-euo pipefail
APP=
"
supabase
"
REPO=
"
supabase/cli
"
INSTALL_DIR=
"
${SUPABASE_INSTALL_DIR
:-
"
$HOME
/.supabase/bin
"
}
"
REQUESTED_VERSION=
"
${VERSION
:-
}
"
NO_MODIFY_PATH=false
BINARY_PATH=
"
"
RED=
"
\033[0;31m
"
MUTED=
"
\033[0;2m
"
GREEN=
"
\033[0;32m
"
NC=
"
\033[0m
"
usage
() {
cat
<<
EOF
Install the Supabase CLI.
Usage:
curl -fsSL https://raw.githubusercontent.com/supabase/cli/main/install | bash
curl -fsSL https://raw.githubusercontent.com/supabase/cli/main/install | bash -s -- --version 2.0.0
Options:
-v, --version <version> Install a specific version, for example 2.0.0.
-d, --install-dir <path> Install into a custom directory.
-b, --binary <path> Install from a local binary instead of downloading.
--no-modify-path Do not update shell config files.
-h, --help Show this help.
Environment:
VERSION Install a specific version.
SUPABASE_INSTALL_DIR Install into a custom directory.
EOF
}
while
[[
$#
-gt
0 ]]
;
do
case
"
$1
"
in
-h | --help)
usage
exit
0
;;
-v | --version)
if
[[
-z
"
${2
:-
}
"
]]
;
then
echo
-e
"
${RED}
Error: --version requires a version.
${NC}
"
>&2
exit
1
fi
REQUESTED_VERSION=
"
$2
"
shift
2
;;
-d | --install-dir)
if
[[
-z
"
${2
:-
}
"
]]
;
then
echo
-e
"
${RED}
Error: --install-dir requires a path.
${NC}
"
>&2
exit
1
fi
INSTALL_DIR=
"
$2
"
shift
2
;;
-b | --binary)
if
[[
-z
"
${2
:-
}
"
]]
;
then
echo
-e
"
${RED}
Error: --binary requires a path.
${NC}
"
>&2
exit
1
fi
BINARY_PATH=
"
$2
"
shift
2
;;
--no-modify-path)
NO_MODIFY_PATH=true
shift
;;
*
)
echo
-e
"
${RED}
Error: unknown option '
$1
'.
${NC}
"
>&2
usage
>&2
exit
1
;;
esac
done
say
() {
echo
-e
"
$1
"
}
need
() {
if
!
command
-v
"
$1
"
>
/dev/null
2>&1
;
then
echo
-e
"
${RED}
Error: '
$1
' is required but was not found.
${NC}
"
>&2
exit
1
fi
}
detect_target
() {
local
raw_os raw_arch os arch
raw_os=
"
$(
uname -s
)
"
raw_arch=
"
$(
uname -m
)
"
case
"
$raw_os
"
in
Darwin
*
) os=
"
darwin
"
;;
Linux
*
) os=
"
linux
"
;;
MINGW
*
| MSYS
*
| CYGWIN
*
) os=
"
windows
"
;;
*
)
echo
-e
"
${RED}
Error: unsupported OS '
$raw_os
'.
${NC}
"
>&2
exit
1
;;
esac
case
"
$raw_arch
"
in
x86_64 | amd64) arch=
"
amd64
"
;;
arm64 | aarch64) arch=
"
arm64
"
;;
*
)
echo
-e
"
${RED}
Error: unsupported architecture '
$raw_arch
'.
${NC}
"
>&2
exit
1
;;
esac
if
[[
"
$os
"
==
"
darwin
"
&&
"
$arch
"
==
"
amd64
"
]]
;
then
local
translated
translated=
"
$(
sysctl -n sysctl.proc_translated
2>
/dev/null
||
echo
0
)
"
if
[[
"
$translated
"
==
"
1
"
]]
;
then
arch=
"
arm64
"
fi
fi
echo
"
${os}
_
${arch}
"
}
is_musl_linux
() {
[[
-f
/etc/alpine-release ]]
&&
return
0
command
-v ldd
>
/dev/null
2>&1
&&
ldd --version
2>&1
|
grep -qi musl
}
latest_version
() {
curl -fsSL
"
https://api.github.com/repos/
${REPO}
/releases/latest
"
|
sed -n
'
s/.*"tag_name": *"v\([^"]*\)".*/\1/p
'
|
head -n 1
}
check_installed_version
() {
local
version=
"
$1
"
local
bin=
"
${INSTALL_DIR}
/
${APP}
"
local
installed_version
if
[[
!
-x
"
$bin
"
]]
;
then
return
0
fi
installed_version=
"
$(
"
$bin
"
--version
2>
/dev/null
||
true
)
"
if
[[
"
$installed_version
"
==
"
$version
"
]]
;
then
say
"
${MUTED}
Version
${NC}${version}${MUTED}
is already installed at
${NC}${bin}${MUTED}
.
${NC}
"
exit
0
fi
}
checksum_for
() {
local
file=
"
$1
"
local
checksums=
"
$2
"
awk -v file=
"
$file
"
'
$2 == file { print $1 }
'
"
$checksums
"
}
verify_checksum
() {
local
file=
"
$1
"
local
checksums=
"
$2
"
local
expected actual
expected=
"
$(
checksum_for
"
$(
basename
"
$file
"
)
"
"
$checksums
"
)
"
if
[[
-z
"
$expected
"
]]
;
then
say
"
${MUTED}
No checksum found for
$(
basename
"
$file
"
)
; skipping verification.
${NC}
"
return
0
fi
if
command
-v sha256sum
>
/dev/null
2>&1
;
then
actual=
"
$(
sha256sum
"
$file
"
|
awk
'
{ print $1 }
'
)
"
elif
command
-v shasum
>
/dev/null
2>&1
;
then
actual=
"
$(
shasum -a 256
"
$file
"
|
awk
'
{ print $1 }
'
)
"
else
say
"
${MUTED}
No sha256 tool found; skipping checksum verification.
${NC}
"
return
0
fi
if
[[
"
$actual
"
!=
"
$expected
"
]]
;
then
echo
-e
"
${RED}
Error: checksum verification failed for
$(
basename
"
$file
"
)
.
${NC}
"
>&2
exit
1
fi
}
install_from_binary
() {
local
ext=
"
$1
"
if
[[
!
-f
"
$BINARY_PATH
"
]]
;
then
echo
-e
"
${RED}
Error: binary not found at '
$BINARY_PATH
'.
${NC}
"
>&2
exit
1
fi
mkdir -p
"
$INSTALL_DIR
"
cp
"
$BINARY_PATH
"
"
${INSTALL_DIR}
/
${APP}${ext}
"
chmod 755
"
${INSTALL_DIR}
/
${APP}${ext}
"
}
download_and_install
() {
local
target=
"
$1
"
local
ext=
"
$2
"
local
version filename base_url tmp_dir archive checksums source_dir companion_ext
need curl
need tar
need awk
need sed
need head
version=
"
${REQUESTED_VERSION
#
v}
"
if
[[
-z
"
$version
"
]]
;
then
version=
"
$(
latest_version
)
"
fi
if
[[
-z
"
$version
"
]]
;
then
echo
-e
"
${RED}
Error: failed to resolve the latest Supabase CLI version.
${NC}
"
>&2
exit
1
fi
check_installed_version
"
$version
"
filename=
"
supabase_
${version}
_
${target}
.tar.gz
"
if
[[
"
$target
"
==
linux_
*
]]
&&
is_musl_linux
;
then
filename=
"
supabase_
${version}
_
${target}
.apk
"
fi
base_url=
"
https://github.com/
${REPO}
/releases/download/v
${version}
"
tmp_dir=
"
$(
mktemp -d
"
${TMPDIR
:-/
tmp}
/supabase-install.XXXXXX
"
)
"
archive=
"
${tmp_dir}
/
${filename}
"
checksums=
"
${tmp_dir}
/checksums.txt
"
source_dir=
"
$tmp_dir
"
trap
'
rm -rf "$tmp_dir"; trap - RETURN
'
RETURN
say
"
${MUTED}
Installing
${NC}${APP}${MUTED}
${version}
for
${target}
.
${NC}
"
curl -fL --progress-bar
"
${base_url}
/
${filename}
"
-o
"
$archive
"
if
curl -fsSL
"
${base_url}
/checksums.txt
"
-o
"
$checksums
"
;
then
verify_checksum
"
$archive
"
"
$checksums
"
else
say
"
${MUTED}
Could not download checksums.txt; skipping verification.
${NC}
"
fi
tar -xzf
"
$archive
"
-C
"
$tmp_dir
"
if
[[
"
$filename
"
==
*
.apk ]]
;
then
source_dir=
"
${tmp_dir}
/usr/bin
"
fi
if
[[
!
-f
"
${source_dir}
/
${APP}${ext}
"
]]
;
then
echo
-e
"
${RED}
Error: archive did not contain
${APP}${ext}
.
${NC}
"
>&2
exit
1
fi
mkdir -p
"
$INSTALL_DIR
"
mv
"
${source_dir}
/
${APP}${ext}
"
"
${INSTALL_DIR}
/
${APP}${ext}
"
chmod 755
"
${INSTALL_DIR}
/
${APP}${ext}
"
companion_ext=
"
$ext
"
if
[[
-f
"
${source_dir}
/
${APP}
-go
${companion_ext}
"
]]
;
then
mv
"
${source_dir}
/
${APP}
-go
${companion_ext}
"
"
${INSTALL_DIR}
/
${APP}
-go
${companion_ext}
"
chmod 755
"
${INSTALL_DIR}
/
${APP}
-go
${companion_ext}
"
fi
}
path_command_for_shell
() {
local
shell_name=
"
$1
"
case
"
$shell_name
"
in
fish)
echo
"
fish_add_path
$INSTALL_DIR
"
;;
*
)
echo
"
export PATH=
\"
$INSTALL_DIR
:
\$
PATH
\"
"
;;
esac
}
config_file_for_shell
() {
local
shell_name=
"
$1
"
case
"
$shell_name
"
in
fish)
echo
"
${XDG_CONFIG_HOME
:-
"
$HOME
/.config
"
}
/fish/config.fish
"
;;
zsh)
echo
"
${ZDOTDIR
:-
"
$HOME
"
}
/.zshrc
"
;;
bash)
echo
"
$HOME
/.bashrc
"
;;
*
)
echo
"
$HOME
/.profile
"
;;
esac
}
add_to_path
() {
local
shell_name config_file
command
if
[[
"
$NO_MODIFY_PATH
"
==
"
true
"
]]
;
then
return
0
fi
if
[[
"
:
$PATH
:
"
==
*
"
:
$INSTALL_DIR
:
"
*
]]
;
then
return
0
fi
shell_name=
"
$(
basename
"
${SHELL
:-
sh}
"
)
"
config_file=
"
$(
config_file_for_shell
"
$shell_name
"
)
"
command=
"
$(
path_command_for_shell
"
$shell_name
"
)
"
mkdir -p
"
$(
dirname
"
$config_file
"
)
"
touch
"
$config_file
"
if
grep -Fxq
"
$command
"
"
$config_file
"
;
then
return
0
fi
{
echo
"
"
echo
"
# Supabase CLI
"
echo
"
$command
"
}
>>
"
$config_file
"
say
"
${MUTED}
Added
${NC}${APP}${MUTED}
to PATH in
${NC}${config_file}${MUTED}
.
${NC}
"
}
target=
"
$(
detect_target
)
"
binary_ext=
"
"
if
[[
"
$target
"
==
windows_
*
]]
;
then
binary_ext=
"
.exe
"
fi
if
[[
-n
"
$BINARY_PATH
"
]]
;
then
install_from_binary
"
$binary_ext
"
else
download_and_install
"
$target
"
"
$binary_ext
"
fi
add_to_path
if
[[
"
${GITHUB_ACTIONS
:-
}
"
==
"
true
"
&&
-n
"
${GITHUB_PATH
:-
}
"
]]
;
then
echo
"
$INSTALL_DIR
"
>>
"
$GITHUB_PATH
"
fi
say
"
"
say
"
${GREEN}
Supabase CLI installed to
${INSTALL_DIR}
/
${APP}${binary_ext}
.
${NC}
"
say
"
Run '
${APP}
--version' to verify the installation.
"
if
[[
"
:
$PATH
:
"
!=
*
"
:
$INSTALL_DIR
:
"
*
]]
;
then
say
"
${MUTED}
Open a new terminal or run: export PATH=
\"
${INSTALL_DIR}
:
\$
PATH
\"
${NC}
"
fi
You can’t perform that action at this time.