Not able to install go 1.13 in go env. goenv install 1.13.6 fails with - go-build: definition not found: 1.13.6 - go

I am trying to install different Go versions for various projects
1. goenv install 1.11.4 was successful
2. go env install 1.13.6 failed with error - go-build: definition not found: 1.13.6
also when i checked available versions for goenv using
goenv install --list
The last one I got is
.......
.......
1.10.3
1.10.4
1.10.5
1.10.6
1.10.7
1.11.0
1.11beta2
1.11beta3
1.11rc1
1.11rc2
1.11.1
1.11.2
1.11.3
1.11.4
1.12beta1
Go is available till 1.14 now
Why all the versions of Go are not available to install in goenv

Try uninstalling goenv and then reinstalling it with --HEAD. For OSX, it would look like:
brew uninstall goenv
brew install --HEAD goenv
If that doesn't work, try running the same set of commands once more. Since the new version is still in beta, goenv uses the previous version (without 1.14.x) as its default.

Related

Need help installing Ruby 2.7.2 on Mac

I'm trying to install Ruby version 2.7.2 on my Mac (latest OS with all updates) and did the following
brew update
brew upgrade rbenv ruby-build
and then
rbenv install 2.7.2
ruby-build: definition not found: 2.7.2
See all available versions with `rbenv install --list'.
If the version you need is missing, try upgrading ruby-build:
brew update && brew upgrade ruby-build
So I tried following the instructions above and get this
brew update && brew upgrade ruby-build
Already up-to-date.
Warning: ruby-build 20200926 already installed
You need to install the latest ruby-build
$ brew unlink ruby-build # remove STABLE version
$ brew install --HEAD ruby-build
$ rbenv install -l | grep '2.7.2'
2.7.2
Only latest stable releases for each Ruby implementation are shown.
Use 'rbenv install --list-all' to show all local versions.
The answer from #andrei-kovrov is correct but, alternatively, you can wait until this PR gets merged:
https://github.com/Homebrew/homebrew-core/pull/62096
Btw, this answer will not age well so, for reference, this is where the formulae are staged before they get released:
https://github.com/Homebrew/homebrew-core/pulls
It might be an issue reading the correct version of ruby based on the path that is specified. If you already have another version of ruby installed the path might not be updated to look for a newer version.
This article has a lot of really great information on how to set up ruby on a mac:
https://stackify.com/install-ruby-on-your-mac-everything-you-need-to-get-going/

When brew does not have latest package version

How do I force brew to install latest version of neovim (ver 0.5.0) when brew's formula only has 0.4.3?
I have tried:
brew update
brew upgrade neovim
And it says: Warning: neovim 0.4.3 already installed
I went brew's git repo and checked on neovim formula. Brew has neovim's 0.4.3, not 0.5.0. So brew update/upgrade is not going to help. https://github.com/Homebrew/homebrew-core/blob/master/Formula/neovim.rb
I'm thinking of just downloading neovim from neovim repo and installing it manually, but I'm afraid I'll have to manage updates and dependencies if I do this manual install.
curl -LO https://github.com/neovim/neovim/releases/download/nightly/nvim-macos.tar.gz
tar xzf nvim-macos.tar.gz
./nvim-osx64/bin/nvim
What should I do?
I fixed this with the following steps:
1) Unlink old neovim version:
brew unlink neovim ... and 2)
Install pointing to head:
brew install --HEAD neovim
... This installed neovim 0.5.0.
According to the brew doc, brew install --HEAD will install the master branch of the package. For neovim, it means that the latest version of neovim will be built for you, which may not be stable enough or even compile.
I suggest you install the nightly binary version of neovim. The best way to get the nightly version is to download from the binary release. No dependency is required to install if you download the binary release.
If you don't want to do this manually, you can write a bash script to automate this.

Unable to brew switch go versions

I have go versions 1.13.1 and 1.12.9 installed
$brew list --versions | grep go
go 1.13.1
go#1.12 1.12.9
But I am unable to switch to 1.12, an error indicates that I only have version 1.13.1 installed contradicting the earlier listing.
$brew switch go 1.12
Error: go does not have a version "1.12" in the Cellar.
go installed versions: 1.13.1
And when I look carefully at go versions (no grep)
$brew list --versions go
go 1.13.1
So I must have done something wrong when I installed go 1.12, but what? I used brew install go#1.12, should I have used another syntax?
go and go#1.12 are installed as two packages with different names, which means they are installed at different locations. /usr/local/Cellar/go and /usr/local/Cellar/go#1.12.
In this situation, you should use brew link.
brew unlink go
brew link go#1.12 --overwrite
Update 1
More explanation about brew switch. brew switch <version> is used to switch version installed with the same package name.
For example, If both go 1.13 and 1.13.1 installed, they're put in
/usr/local/Cellar/go/1.13
/usr/local/Cellar/go/1.13.1
In this situation, use brew switch.
brew switch go 1.13
brew switch go 1.13.1
Update 2
brew switch has been dropped since Homebrew 2.6.0.
Anyone still want the old brew switch, use the following tap, where brew switch is included as a custom sub-command.
brew tap laggardkernel/tap
brew switch --help
Instead of switch, you can use gvm Go Version Manager.
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
source ~/.gvm/scripts/gvm
gvm install go1.19
gvm use go1.19 [--default]

How to upgrade to Dart 2?

In my macOS I need to install or upgrade to dart 2. But when I try I m getting this error. Any help please?
$ brew install dart
Warning: dart-lang/dart/dart 1.24.3 is already installed and up-to-date
To reinstall 1.24.3, run `brew reinstall dart`
$ brew install dart --devel
==> Installing dart from dart-lang/dart
Error: dart 1.24.3 is already installed
To upgrade to 2.0.0-dev.63.0, run `brew upgrade dart`
$ brew upgrade dart
Error: dart-lang/dart/dart 1.24.3 already installed
...
Here is an alternative to what Gunter suggested.
Install Dart 2 without uninstalling Dart 1
> brew upgrade dart --devel --force
If you don't have Dart 1 installed, then simply use:
> brew install dart --devel
Switching between Dart 1 and Dart 2
To switch to Dart 1, use the switch command followed by the version of Dart 1 that you have installed. For example:
> brew switch dart 1.24.3
Switching back to Dart 2 is similar, for example:
> brew switch dart 2.0.0-dev.64.1
Listing Dart versions
If you aren't sure which versions of dart you have installed, then run brew info:
> brew info dart
dart-lang/dart/dart: stable 1.24.3, devel 2.0.0-dev.64.1
The Dart SDK
https://www.dartlang.org/
***[Your locally installed versions of dart will be listed here]***
Using dart#2 and dart#1 formulas
Until Dart 2 final is released, you can use the brew formulas dart#1 and dart#2 as illustrated below.
WARNING: these formulas are keg-only, which means installed binaries are not symlinked in the usual way. Follow the instructions in the command output to set your PATH appropriately.
> brew install dart#2
==> Installing dart#2 from dart-lang/dart
==> Downloading https://storage.googleapis.com/dart-archive/channels/dev/release/2.0.0-dev.64.1/sdk/dartsdk-macos-x64-release.zip
######################################################################## 100.0%
==> Caveats
Note that this is a prerelease version of Dart.
Please note the path to the Dart SDK:
/<your-brew-root-path>/opt/dart#2/libexec
This formula is keg-only, which means it was not symlinked into /...,
because this is an alternate version of another formula.
If you need to have this software first in your PATH run:
echo 'export PATH="/<your-brew-root-path>/opt/dart#2/bin:$PATH"' >> ~/.bash_profile
The warning text seems to be a bit unfortunate.
As far as I remember this worked for me
brew uninstall dart
# brew install dart --devel
brew install dart#2 # new
brew uninstall dart
brew tap dart-lang/dart
brew install dart --devel
brew upgrade dart
you need brew install dart --devel since dart version 2 is still in beta and as such is only available on the developer channel.
If you got 403 (forbidden) response
curl: (22) The requested URL returned error: 403
try this
You would have problem with switching on brew 2.6 and above. The brew switch command was removed after the 2.6 release of Homebrew here
download sdk from source as mentioned here
unzip at /usr/local/Cellar/dart and name extracted directory to sdk version: e.g 2.12.4/
change previous version directory name : e.g 2.8.4 -> dart-backup
now you should have two directory : 2.12.4/ and dart-backup/
brew unlink dart to remove symlinks
brew info dart and make sure non of versions under Conflicts with are selected. (here you should see both 2.12.4 and dart-backup directories)
brew link dart and it will link to 2.12.4
These steps worked for me
In the case, you install dart with flutter. Just need to run this command line:
flutter upgrade
Then flutter will upgrade the dart sdk too.

Switching Ruby versions using homebrew

One of the projects that I've been working has a dependency on ruby#2.3.
I'm using a Mac and the version of Ruby that I used for other projects is the 2.5.
I want to temporarily switch from 2.5 to 2.3 using brew. I don't want to use neither rbenv nor rvm.
1. I've installed the 2.3.7 version, using brew:
bf-old> brew install ruby#2.3
Warning: ruby#2.3 2.3.7 is already installed and up-to-date
To reinstall 2.3.7, run `brew reinstall ruby#2.3
2. I'm trying to switch to it, but it's not working:
bf-old> brew switch 2.3.7
Error: 2.3.7 not found in the Cellar.
What can I do about this?
Check if both the ruby versions are installed.
If both are installed, then try this:
brew unlink ruby#2.5 && brew link --force --overwrite ruby#2.3

Resources