-
Notifications
You must be signed in to change notification settings - Fork 6.3k
-
In both macos
and unbuntu
, use the following command to install directly:
curl -fsSL https://code-server.dev/install.sh | sh
Then, in macOS:
$ code-server --help
code-server 4.93.1 69df01185ce2f80e99c9e4f8c8de1907cc7a9bc5 with Code 1.93.1
Usage: code-server [options] [path]
- Opening a directory: code-server ./path/to/your/project
- Opening a saved workspace: code-server ./path/to/your/project.code-workspace
Options
--auth The type of authentication to use. [password, none]
--password The password for password authentication (can only be passed in via $PASSWORD or the config file).
--hashed-password The password hashed with argon2 for password authentication (can only be passed in via $HASHED_PASSWORD or the config file).
Takes precedence over 'password'.
--cert Path to certificate. A self signed certificate is generated if none is provided.
--cert-host Hostname to use when generating a self signed certificate.
--cert-key Path to certificate key when using non-generated cert.
--disable-telemetry Disable telemetry.
--disable-update-check Disable update check. Without this flag, code-server checks every 6 hours against the latest github release and
then notifies you once every week that a new release is available.
--disable-file-downloads Disable file downloads from Code. This can also be set with CS_DISABLE_FILE_DOWNLOADS set to 'true' or '1'.
--disable-file-uploads Disable file uploads.
--disable-workspace-trust Disable Workspace Trust feature. This switch only affects the current session.
--disable-getting-started-override Disable the coder/coder override in the Help: Getting Started page.
--disable-proxy Disable domain and path proxy routes.
-h --help Show this output.
--locale Set vscode display language and language to show on the login page, more info see
https://en.wikipedia.org/wiki/IETF_language_tag
--open Open in browser on startup. Does not work remotely.
--bind-addr Address to bind to in host:port. You can also use $PORT to override the port.
--config Path to yaml config file. Every flag maps directly to a key in the config file.
--socket Path to a socket (bind-addr will be ignored).
--socket-mode File mode of the socket.
--trusted-origins Disables authenticate origin check for trusted origin. Useful if not able to access reverse proxy configuration.
-v --version Display version information.
--user-data-dir Path to the user data directory.
--extensions-dir Path to the extensions directory.
--list-extensions List installed VS Code extensions.
--force Avoid prompts when installing VS Code extensions.
--install-extension Install or update a VS Code extension by id or vsix. The identifier of an extension is `${publisher}.${name}`.
To install a specific version provide `@${version}`. For example: 'vscode.csharp@1.2.3'.
--enable-proposed-api Enable proposed API features for extensions. Can receive one or more extension IDs to enable individually.
--uninstall-extension Uninstall a VS Code extension by id.
--show-versions Show VS Code extension versions.
--github-auth GitHub authentication token (can only be passed in via $GITHUB_TOKEN or the config file).
--proxy-domain Domain used for proxying ports.
-e --ignore-last-opened Ignore the last opened directory or workspace in favor of an empty window.
-n --new-window Force to open a new window.
-r --reuse-window Force to open a file or folder in an already opened window.
-vvv --verbose Enable verbose logging.
-an --app-name The name to use in branding. Will be shown in titlebar and welcome message
-w --welcome-text Text to show on login page
--abs-proxy-base-path The base path to prefix to all absproxy requests
In Ubuntu:
$ code-server --help
code-server 1.93.1
Usage: code-server [options][paths...]
To read from stdin, append '-' (e.g. 'ps aux | grep code | code-server -')
Options
-d --diff <file> <file> Compare two files with each other.
-m --merge <path1> <path2> <base> <result> Perform a three-way merge by providing paths for two modified versions of a file, the
common origin of both modified versions and the output file to save merge results.
-a --add <folder> Add folder(s) to the last active window.
-g --goto <file:line[:character]> Open a file at the path on the specified line and character position.
-n --new-window Force to open a new window.
-r --reuse-window Force to open a file or folder in an already opened window.
-w --wait Wait for the files to be closed before returning.
-h --help Print usage.
-c --stdin-to-clipboard copies the STDIN to the clipboard
Extensions Management
--list-extensions List the installed extensions.
--show-versions Show versions of installed extensions, when using --list-extensions.
--category <category> Filters installed extensions by provided category, when using --list-extensions.
--install-extension <ext-id | path> Installs or updates an extension. The argument is either an extension id or a path to a
VSIX. The identifier of an extension is '${publisher}.${name}'. Use '--force' argument to
update to latest version. To install a specific version provide '@${version}'. For example:
'vscode.csharp@1.2.3'.
--uninstall-extension <ext-id> Uninstalls an extension.
--update-extensions Update the installed extensions.
Troubleshooting
-v --version Print version.
--verbose Print verbose output (implies --wait).
-s --status Print process usage and diagnostics information.
Beta Was this translation helpful? Give feedback.
All reactions
Actually:
Replies: 4 comments 58 replies
-
code-server on macOS and Ubuntu are running on different versions - check the output you'll see it. Basically Ubuntu is running a very old version of code-server.
There's something off with this, as the cURL command installs the latest version of code-server for the system, along with the specific architecture(amd64, arm64, etc.). Re-run the cURL command, but dry run it, and spot which version it mentions.
Edit: the version changed from 4.93.1(macOS) to 1.93.1(Ubuntu Linux). Something may be wrong with install.sh
Beta Was this translation helpful? Give feedback.
All reactions
-
Update: I tested this on a cloud instance of Ubuntu(Gitpod), and everything looks good. @qupig can you tell me which version of Ubuntu you may be using? Basically info about the Ubuntu system/VM/instance.
It might be due to something in the system, since the Ubuntu instance I just used is 22.04, and the dry-run looks good.
https://asciinema.org/a/UMcTWzWj5ag8LZSnNkGekQ6vB
The link above is an asciinema recording of what I re-ran for proof.
Beta Was this translation helpful? Give feedback.
All reactions
-
Looking at the installation output, I don't think an older version is installed?
> curl -fsSL https://code-server.dev/install.sh | sh
Ubuntu 22.04.5 LTS
Installing v4.93.1 of the amd64 deb package from GitHub.
+ mkdir -p ~/.cache/code-server
+ curl -#fL -o ~/.cache/code-server/code-server_4.93.1_amd64.deb.incomplete -C - https://github.com/coder/code-server/releases/download/v4.93.1/code-server_4.93.1_amd64.deb
######################################################################## 100.0%
+ mv ~/.cache/code-server/code-server_4.93.1_amd64.deb.incomplete ~/.cache/code-server/code-server_4.93.1_amd64.deb
+ sudo dpkg -i ~/.cache/code-server/code-server_4.93.1_amd64.deb
Selecting previously unselected package code-server.
(Reading database ... 266916 files and directories currently installed.)
Preparing to unpack .../code-server_4.93.1_amd64.deb ...
Unpacking code-server (4.93.1) ...
Setting up code-server (4.93.1) ...
deb package has been installed.
Beta Was this translation helpful? Give feedback.
All reactions
-
Huh...
Well that's odd, can you check if you have the latest version now?
Edit: this isn't from the asciinema which then means that you have the latest LTS Ubuntu version. But then this isn't possible, you can't have an older version.
Beta Was this translation helpful? Give feedback.
All reactions
-
I think I've found the cause of the issue, but I'm not sure how it happened.
> /usr/bin/code-server -v
4.93.1 69df01185ce2f80e99c9e4f8c8de1907cc7a9bc5 with Code 1.93.1
> /usr/lib/code-server/bin/code-server -v
4.93.1 69df01185ce2f80e99c9e4f8c8de1907cc7a9bc5 with Code 1.93.1
> which code-server
/usr/lib/code-server/lib/vscode/bin/remote-cli/code-server
> /usr/lib/code-server/lib/vscode/bin/remote-cli/code-server -v
1.93.1
3542bd157b0ccc8bf732acdb03d4d69d85f48ea9
x64
Again, I don't know why:
> echo $PATH
/usr/lib/code-server/lib/vscode/bin/remote-cli:...:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
I am running the above commands in code-server
instance, that is vscode’s built-in TERMINAL
panel with bash
.
Do you think it's possible that in the instance,/usr/lib/code-server/lib/vscode/bin/remote-cli
was automatically added to $PATH
?
Anyway, the same way of doing things, which works without issue in macOS
, but occurs in Ubuntu
.
Beta Was this translation helpful? Give feedback.
All reactions
-
I tested it on a fresh Ubuntu system and my suspicions were confirmed.
The /usr/lib/code-server/lib/vscode/bin/remote-cli
is added to PATH
to the built-in TERMINAL
by the code-server
instance.
That is, in the external SHELL environment, there is no such extra path, and that path only exists in the terminal in the code-server
instance.
Beta Was this translation helpful? Give feedback.
All reactions
-
Well then you can fix it right? Something might be wrong with code-server here, so once I test it I'll ping maintainers and let them know. @qupig can you try fixing this issue by editing the PATH variable? Or can you edit it in the first place?
Beta Was this translation helpful? Give feedback.
All reactions
-
Why should I edit PATH
env?
Apparently editing the PATH
env could fixes it, but I didn't add it and I shouldn't edit or delete it.
I could directly run /usr/bin/code-server --help
instead.
There are already so many identical issues out there that you can definitely report it to the maintainers if they are really willing to fix it.
Beta Was this translation helpful? Give feedback.
All reactions
-
You could add an alias to your shell or try creating a symbolic link, something might help remedy that. I can't imagine anyone running code-server by putting the actual executable in, so that oughta remedy your issue for now.
I'll try something and reproduce this, and maybe I'll get some idea on a fix.
Beta Was this translation helpful? Give feedback.
All reactions
-
Unfortunately, I cannot recreate this issue, maybe due to factors with Gitpod.
I looked up the other issues, and I understand one thing: Microsoft's code-server gets more priority than our code-server. I think Microsoft is issuing PATH as [path-to-their-code-server]:$PATH
but they aren't fixing that, and that's what is leading to this conflict. Moreover, both programs share the same name. There is no permanent fix for this yet, but rearranging PATH, creating an alias, or trying some symbolic link might work.
Beta Was this translation helpful? Give feedback.
All reactions
-
Actually:
- [Bug]: Cannot invoke
code-server
from integrated terminal #5335 - fix: invoking code-server in integrated terminal #5360
- Coder/code-server conflicts with the startup command of visual studio code server[Bug]: #5502
- [Bug]: code-server (run with docker) will always overwrite PATH variable #5621 (comment)
- [Feat]: I wonder if you can create a choice that we can chose config file in other path #6240 (comment)
Beta Was this translation helpful? Give feedback.
All reactions
-
The issue is years old, it doesn't seem like it will be fixed, and it's not well documented.
This means that everyone falls down this rabbit hole. 😫
Beta Was this translation helpful? Give feedback.
All reactions
-
If I understand correctly, what is going on here is that in some cases our code-server
command is being ran, and in other cases VS Code's code-server
is being ran.
VS Code's runs in the integrated terminal by default (it gets automatically added to PATH
). This version of code-server
allows interacting with the current instance of code-server (for example opening a file in the current instance), but it does not allow spawning a full new code-server instance; they are different scripts and have different options and purposes (although there is overlap).
Understandably confusing! This is how it works upstream though, so it is not specific to code-server, and appears to be the intended behavior.
Beta Was this translation helpful? Give feedback.
All reactions
-
Or actually maybe it would be OK if we said to use this, run this command instead: <print the new name here>
Beta Was this translation helpful? Give feedback.
All reactions
-
I recommend not mixing the flags of the two tools together, since that is actually maintained by two different teams, any future modifications will easily create new conflicts.
As a relatively easy alternative, and something that can be done by this downstream project, is to ensure that the project's code-server
command always has priority in the PATH, whether it is an external terminal or an internal integrated terminal. (i.e. make sure it always overrides the upstream project and will not confuse users)
For the code-server
command in the upstream original remote-cli, you could:
- Make an alias like
code-server-instance
- It is detected that the
code-server
command is running in the inherited terminal, and a prompt is given at the beginning: <If you need to control this instance, please run the absolute path "/.../bin/remote-cli/code-server"> or if alias in last step <If you need to control this instance, please usecode-server-instance
command>
Or actually maybe it would be OK if we said to use this, run this command instead:
I recommend that you never do this. It prompts you to run another command after entering some flags exist.
This is definitely a disaster. Very bad user experience.
If you don't function/maintain these flags, don't add them.
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
I agree giving ours priority is a good idea, but we have to implement the missing flags first (--wait
, etc) to avoid a breaking change.
Unfortunately, I think we are stuck copying the flags in order to support them in external terminals.
Beta Was this translation helpful? Give feedback.
All reactions
-
Suffice it to say, if "breaking change" ends the ongoing chaos that has been and will continue to be, then it's worth it.
Regardless, at least having this documented well in somewhere prevents others from suffering the same confusion.
Thank you for your work and I will respect your decision.
Beta Was this translation helpful? Give feedback.
All reactions
-
I appreciate your input!
Copying the flags is pretty quick so if we did this I would like to copy the missing ones real quick first and skip the breaking change.
Truthfully though, we update VS Code and merge PRs but are not actively working on the project so it may not happen for a while 😅
Beta Was this translation helpful? Give feedback.
All reactions
-
❤️ 1