{"id":13765726,"url":"https://github.com/HiroakiMikami/jlenv","last_synced_at":"2025-05-10T21:31:39.629Z","repository":{"id":75623705,"uuid":"106077560","full_name":"HiroakiMikami/jlenv","owner":"HiroakiMikami","description":"Simple Julia version management (Julia version of rbenv and pyenv)","archived":false,"fork":false,"pushed_at":"2018-10-28T05:11:48.000Z","size":495,"stargazers_count":26,"open_issues_count":2,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-13T17:52:23.020Z","etag":null,"topics":["julia","version-manager"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HiroakiMikami.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-10-07T06:52:14.000Z","updated_at":"2024-08-13T06:03:54.000Z","dependencies_parsed_at":"2023-06-07T03:45:18.398Z","dependency_job_id":null,"html_url":"https://github.com/HiroakiMikami/jlenv","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HiroakiMikami%2Fjlenv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HiroakiMikami%2Fjlenv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HiroakiMikami%2Fjlenv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HiroakiMikami%2Fjlenv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HiroakiMikami","download_url":"https://codeload.github.com/HiroakiMikami/jlenv/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224989420,"owners_count":17403408,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["julia","version-manager"],"created_at":"2024-08-03T16:00:44.635Z","updated_at":"2024-11-17T01:31:20.979Z","avatar_url":"https://github.com/HiroakiMikami.png","language":"Shell","funding_links":[],"categories":["Version Managers"],"sub_categories":["Julia"],"readme":"# jlenv: Simple Julia Version Management\n\nThis project was forked from [rbenv](https://github.com/rbenv/rbenv.git)\n\n---\n\nUse jlenv to pick a Julia version for your application and guarantee\nthat your development environment matches production.\n\n**Powerful in development.** Specify your app's Julia version once,\n  in a single file. Keep all your teammates on the same page. No\n  headaches running apps on different versions of Julia. Just Works™\n  from the command line and with app servers like [Pow](http://pow.cx).\n  Override the Julia version anytime: just set an environment variable.\n\n**Rock-solid in production.** Your application's executables are its\n  interface with ops. The Julia version\n  dependency lives in one place—your app—so upgrades and rollbacks are\n  atomic, even when you switch versions.\n\n**One thing well.** jlenv is concerned solely with switching Julia\n  versions. It's simple and predictable. A rich plugin ecosystem lets\n  you tailor it to suit your needs. Compile your own Julia versions, or\n  use the [julia-build][]\n  plugin to automate the process.\n  See more [plugins on the\n  wiki](https://github.com/jlenv/rbenv/wiki/Plugins).\n\n## Table of Contents\n\n* [How It Works](#how-it-works)\n  * [Understanding PATH](#understanding-path)\n  * [Understanding Shims](#understanding-shims)\n  * [Choosing the Julia Version](#choosing-the-julia-version)\n  * [Locating the Julia Installation](#locating-the-julia-installation)\n* [Installation](#installation)\n\u003c!--\n  * [Homebrew on macOS](#homebrew-on-macos)\n    * [Upgrading with Homebrew](#upgrading-with-homebrew)\n--\u003e\n  * [Basic GitHub Checkout](#basic-github-checkout)\n    * [Upgrading with Git](#upgrading-with-git)\n  * [How jlenv hooks into your shell](#how-jlenv-hooks-into-your-shell)\n  * [Installing Julia versions](#installing-julia-versions)\n    * [Installing Julia gems](#installing-julia-gems)\n  * [Uninstalling Julia versions](#uninstalling-julia-versions)\n  * [Uninstalling jlenv](#uninstalling-jlenv)\n* [Command Reference](#command-reference)\n  * [jlenv local](#jlenv-local)\n  * [jlenv global](#jlenv-global)\n  * [jlenv shell](#jlenv-shell)\n  * [jlenv versions](#jlenv-versions)\n  * [jlenv version](#jlenv-version)\n  * [jlenv rehash](#jlenv-rehash)\n  * [jlenv which](#jlenv-which)\n  * [jlenv whence](#jlenv-whence)\n* [Environment variables](#environment-variables)\n* [Development](#development)\n\n## How It Works\n\nAt a high level, jlenv intercepts Julia commands using shim\nexecutables injected into your `PATH`, determines which Julia version\nhas been specified by your application, and passes your commands along\nto the correct Julia installation.\n\n### Understanding PATH\n\nWhen you run a command like `julia`, your operating system\nsearches through a list of directories to find an executable file with\nthat name. This list of directories lives in an environment variable\ncalled `PATH`, with each directory in the list separated by a colon:\n\n    /usr/local/bin:/usr/bin:/bin\n\nDirectories in `PATH` are searched from left to right, so a matching\nexecutable in a directory at the beginning of the list takes\nprecedence over another one at the end. In this example, the\n`/usr/local/bin` directory will be searched first, then `/usr/bin`,\nthen `/bin`.\n\n### Understanding Shims\n\njlenv works by inserting a directory of _shims_ at the front of your\n`PATH`:\n\n    ~/.jlenv/shims:/usr/local/bin:/usr/bin:/bin\n\nThrough a process called _rehashing_, jlenv maintains shims in that\ndirectory to match every Julia command across every installed version\nof Julia.\n\nShims are lightweight executables that simply pass your command along\nto jlenv. So with jlenv installed, when you run, say, `julia`, your\noperating system will do the following:\n\n* Search your `PATH` for an executable file named `julia`\n* Find the jlenv shim named `julia` at the beginning of your `PATH`\n* Run the shim named `julia`, which in turn passes the command along to\n  jlenv\n\n### Choosing the Julia Version\n\nWhen you execute a shim, jlenv determines which Julia version to use by\nreading it from the following sources, in this order:\n\n1. The `JLENV_VERSION` environment variable, if specified. You can use\n   the [`jlenv shell`](#jlenv-shell) command to set this environment\n   variable in your current shell session.\n\n2. The first `.julia-version` file found by searching the directory of the\n   script you are executing and each of its parent directories until reaching\n   the root of your filesystem.\n\n3. The first `.julia-version` file found by searching the current working\n   directory and each of its parent directories until reaching the root of your\n   filesystem. You can modify the `.julia-version` file in the current working\n   directory with the [`jlenv local`](#jlenv-local) command.\n\n4. The global `~/.jlenv/version` file. You can modify this file using\n   the [`jlenv global`](#jlenv-global) command. If the global version\n   file is not present, jlenv assumes you want to use the \"system\"\n   Julia—i.e. whatever version would be run if jlenv weren't in your\n   path.\n\n### Locating the Julia Installation\n\nOnce jlenv has determined which version of Julia your application has\nspecified, it passes the command along to the corresponding Julia\ninstallation.\n\nEach Julia version is installed into its own directory under\n`~/.jlenv/versions`. For example, you might have these versions\ninstalled:\n\n* `~/.jlenv/versions/v0.6.0/`\n* `~/.jlenv/versions/v0.6.0-rc3/`\n* `~/.jlenv/versions/v0.5.0/`\n\nVersion names to jlenv are simply the names of the directories in\n`~/.jlenv/versions`.\n\n## Installation\n\n1. Install jlenv.\n   Note that this also installs `julia-build`, so you'll be ready to\n   install other Julia versions out of the box.\n\n2. Run `jlenv init` and follow the instructions to set up\n   jlenv integration with your shell. This is the step that will make\n   running `julia` \"see\" the Julia version that you choose with jlenv.\n\n3. Close your Terminal window and open a new one so your changes take\n   effect.\n\n4. That's it! Installing jlenv includes julia-build, so now you're ready to\n   [install some other Julia versions](#installing-julia-versions) using\n   `jlenv install`.\n\n\n### Basic GitHub Checkout\n\nThis will get you going with the latest version of jlenv without needing\na systemwide install.\n\n1. Clone jlenv into `~/.jlenv`.\n\n    ~~~ sh\n    $ git clone https://github.com/HiroakiMikami/jlenv.git ~/.jlenv\n    ~~~\n\n    Optionally, try to compile dynamic bash extension to speed up jlenv. Don't\n    worry if it fails; jlenv will still work normally:\n\n    ~~~\n    $ cd ~/.jlenv \u0026\u0026 src/configure \u0026\u0026 make -C src\n    ~~~\n\n2. Add `~/.jlenv/bin` to your `$PATH` for access to the `jlenv`\n   command-line utility.\n\n    ~~~ sh\n    $ echo 'export PATH=\"$HOME/.jlenv/bin:$PATH\"' \u003e\u003e ~/.bash_profile\n    ~~~\n\n    **Ubuntu Desktop note**: Modify your `~/.bashrc` instead of `~/.bash_profile`.\n\n    **Zsh note**: Modify your `~/.zshrc` file instead of `~/.bash_profile`.\n\n3. Run `~/.jlenv/bin/jlenv init` and follow the instructions to set up\n   jlenv integration with your shell. This is the step that will make\n   running `julia` \"see\" the Julia version that you choose with jlenv.\n\n4. Restart your shell so that PATH changes take effect. (Opening a new\n   terminal tab will usually do it.)\n\n5. _(Optional)_ Install [julia-build][], which provides the\n   `jlenv install` command that simplifies the process of\n   [installing new Julia versions](#installing-julia-versions).\n\n#### Upgrading with Git\n\nIf you've installed jlenv manually using Git, you can upgrade to the\nlatest version by pulling from GitHub:\n\n~~~ sh\n$ cd ~/.jlenv\n$ git pull\n~~~\n\n### How jlenv hooks into your shell\n\nSkip this section unless you must know what every line in your shell\nprofile is doing.\n\n`jlenv init` is the only command that crosses the line of loading\nextra commands into your shell. Coming from RVM, some of you might be\nopposed to this idea. Here's what `jlenv init` actually does:\n\n1. Sets up your shims path. This is the only requirement for jlenv to\n   function properly. You can do this by hand by prepending\n   `~/.jlenv/shims` to your `$PATH`.\n\n2. Installs autocompletion. This is entirely optional but pretty\n   useful. Sourcing `~/.jlenv/completions/jlenv.bash` will set that\n   up. There is also a `~/.jlenv/completions/jlenv.zsh` for Zsh\n   users.\n\n3. Rehashes shims. From time to time you'll need to rebuild your\n   shim files. Doing this automatically makes sure everything is up to\n   date. You can always run `jlenv rehash` manually.\n\n4. Installs the sh dispatcher. This bit is also optional, but allows\n   jlenv and plugins to change variables in your current shell, making\n   commands like `jlenv shell` possible. The sh dispatcher doesn't do\n   anything crazy like override `cd` or hack your shell prompt, but if\n   for some reason you need `jlenv` to be a real script rather than a\n   shell function, you can safely skip it.\n\nRun `jlenv init -` for yourself to see exactly what happens under the\nhood.\n\n### Installing Julia versions\n\nThe `jlenv install` command doesn't ship with jlenv out of the box, but\nis provided by the [julia-build][] project. If you installed it either\nas part of GitHub checkout process outlined above, you should be able to:\n\n~~~ sh\n# list all available versions:\n$ jlenv install -l\n\n# install a Julia version:\n$ jlenv install v0.6.0\n~~~\n\nAlternatively to the `install` command, you can download and compile\nJulia manually as a subdirectory of `~/.jlenv/versions/`. An entry in\nthat directory can also be a symlink to a Julia version installed\nelsewhere on the filesystem. jlenv doesn't care; it will simply treat\nany entry in the `versions/` directory as a separate Julia version.\n\n### Uninstalling Julia versions\n\nAs time goes on, Julia versions you install will accumulate in your\n`~/.jlenv/versions` directory.\n\nTo remove old Julia versions, simply `rm -rf` the directory of the\nversion you want to remove. You can find the directory of a particular\nJulia version with the `jlenv prefix` command, e.g. `jlenv prefix\n1.8.7-p357`.\n\nThe [julia-build][] plugin provides an `jlenv uninstall` command to\nautomate the removal process.\n\n### Uninstalling jlenv\n\nThe simplicity of jlenv makes it easy to temporarily disable it, or\nuninstall from the system.\n\n1. To **disable** jlenv managing your Julia versions, simply remove the\n  `jlenv init` line from your shell startup configuration. This will\n  remove jlenv shims directory from PATH, and future invocations like\n  `julia` will execute the system Julia version, as before jlenv.\n\n  `jlenv` will still be accessible on the command line, but your Julia\n  apps won't be affected by version switching.\n\n2. To completely **uninstall** jlenv, perform step (1) and then remove\n   its root directory. This will **delete all Julia versions** that were\n   installed under `` `jlenv root`/versions/ `` directory:\n\n        rm -rf `jlenv root`\n\n## Command Reference\n\nLike `git`, the `jlenv` command delegates to subcommands based on its\nfirst argument. The most common subcommands are:\n\n### jlenv local\n\nSets a local application-specific Julia version by writing the version\nname to a `.julia-version` file in the current directory. This version\noverrides the global version, and can be overridden itself by setting\nthe `JLENV_VERSION` environment variable or with the `jlenv shell`\ncommand.\n\n    $ jlenv local v0.6.0\n\nWhen run without a version number, `jlenv local` reports the currently\nconfigured local version. You can also unset the local version:\n\n    $ jlenv local --unset\n\n### jlenv global\n\nSets the global version of Julia to be used in all shells by writing\nthe version name to the `~/.jlenv/version` file. This version can be\noverridden by an application-specific `.julia-version` file, or by\nsetting the `JLENV_VERSION` environment variable.\n\n    $ jlenv global v0.6.0\n\nThe special version name `system` tells jlenv to use the system Julia\n(detected by searching your `$PATH`).\n\nWhen run without a version number, `jlenv global` reports the\ncurrently configured global version.\n\n### jlenv shell\n\nSets a shell-specific Julia version by setting the `JLENV_VERSION`\nenvironment variable in your shell. This version overrides\napplication-specific versions and the global version.\n\n    $ jlenv shell v0.6.0\n\nWhen run without a version number, `jlenv shell` reports the current\nvalue of `JLENV_VERSION`. You can also unset the shell version:\n\n    $ jlenv shell --unset\n\n### jlenv versions\n\nLists all Julia versions known to jlenv, and shows an asterisk next to\nthe currently active version.\n\n    $ jlenv versions\n      v0.6.0\n    * v0.6.0-rc1 (set by /Users/sam/.jlenv/version)\n\n### jlenv version\n\nDisplays the currently active Julia version, along with information on\nhow it was set.\n\n    $ jlenv version\n    v0.6.0 (set by /Users/sam/.jlenv/version)\n\n### jlenv rehash\n\nInstalls shims for all Julia executables known to jlenv (i.e.,\n`~/.jlenv/versions/*/bin/*`). Run this command after you install a new\nversion of Julia, or install a gem that provides commands.\n\n    $ jlenv rehash\n\n### jlenv which\n\nDisplays the full path to the executable that jlenv will invoke when\nyou run the given command.\n\n    $ jlenv which julia\n    /Users/sam/.jlenv/versions/v0.6.0/bin/julia\n\n### jlenv whence\n\nLists all Julia versions with the given command installed.\n\n    $ jlenv whence julia\n    v0.6.0\n\n## Environment variables\n\nYou can affect how jlenv operates with the following settings:\n\nname | default | description\n-----|---------|------------\n`JLENV_VERSION` | | Specifies the Julia version to be used.\u003cbr\u003eAlso see [`jlenv shell`](#jlenv-shell)\n`JLENV_ROOT` | `~/.jlenv` | Defines the directory under which Julia versions and shims reside.\u003cbr\u003eAlso see `jlenv root`\n`JLENV_DEBUG` | | Outputs debug information.\u003cbr\u003eAlso as: `jlenv --debug \u003csubcommand\u003e`\n`JLENV_HOOK_PATH` | [_see wiki_][hooks] | Colon-separated list of paths searched for jlenv hooks.\n`JLENV_DIR` | `$PWD` | Directory to start searching for `.julia-version` files.\n\n## Development\n\nThe jlenv source code is [hosted on\nGitHub](https://github.com/HiroakiMikami/jlenv). It's clean, modular,\nand easy to understand, even if you're not a shell hacker.\n\nTests are executed using [Bats](https://github.com/sstephenson/bats):\n\n    $ bats test\n    $ bats test/\u003cfile\u003e.bats\n\nPlease feel free to submit pull requests and file bugs on the [issue\ntracker](https://github.com/HiroakiMikami/jlenv/issues).\n\n\n  [julia-build]: https://github.com/HiroakiMikami/julia-build#readme\n  [hooks]: https://github.com/rbenv/rbenv/wiki/Authoring-plugins#jlenv-hooks\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHiroakiMikami%2Fjlenv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FHiroakiMikami%2Fjlenv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHiroakiMikami%2Fjlenv/lists"}