I'm fairly new to Nix and migrating from Homebrew. So far I've been able to install quite a bit using:
nix-env -q
nix-env -i
nix-channel --update
nix-env -u
nix-collect-garbage
However, I have not been able to successfully install RStudio. I'd appreciate help in understanding why I've been able to install neovim and emacs with nix-env -i but I can't do the same with RStudio. I'd also appreciate help in understanding how I may/should install RStudio and other similar packages. Thanks.
Update:
The specific commands I tried and the resulting error messages follow.
Attempt #1
nix-env -i RStudio
Attempt #2
nix-env -iA nixpkgs.rstudioWrapper
Error returned for both attempts:
installing ‘RStudio-1.2.1335-wrapper’
error: Package ‘RStudio-1.2.1335’ in /nix/store/25q78bckai9szsc5wv5ndr10c4b1wghv-nixpkgs-20.03pre207249.7e8454fb856/nixpkgs/pkgs/applications/editors/rstudio/default.nix:128 is not supported on ‘x86_64-darwin’, refusing to evaluate.
a) For nixos-rebuild you can set
{ nixpkgs.config.allowUnsupportedSystem = true; }
in configuration.nix to override this.
b) For nix-env, nix-build, nix-shell or any other Nix command you can add
{ allowUnsupportedSystem = true; }
to ~/.config/nixpkgs/config.nix.
Related
I'm trying to install syndesis on minishift following the official guides.
Installed minishift on ubuntu, no issues. Next I've tried
./syndesis minishift --install. In the end it says I have to run local dev builds for sysdesis-server syndesis-ui, etc
./syndesis build --app-images but got some dependency errors
Run syndesis quickstart. All the pods are up except syndesis-server. It doesn't start due to error like UnknownHostException: syndesis-db in the migration bean
Also tried ./syndesis minishift --install --tag 1.8.12 to install stable version but not sure if I'm doing it right cause no success
Any help ?
Sorry for the late response. We moved to use an Operator to do the installation and it caused a bunch of installation issues. If you have minishift installed then on Linux or Mac you should be able to get Syndesis installed using
bash <(curl -sL https://syndes.is/start)
See also: https://github.com/syndesisio/syndesis-quickstarts/blob/master/README.md#3-install-syndesis
It uses the syndesis bash command line tool from (https://github.com/syndesisio/syndesis/blob/master/tools/bin/), so you can check out the code yourself too and run that using:
./.syndesis/bin/syndesis minishift --install --full-reset --nodev --open
and then you can explore other options to specify a tag if you want.
Hope this gets you going!
Cheers,
--Kurt
I installed luarocks on centos7, then I execute 'luarocks install luacheck', there is an error:
'Error: Your user does not have write permissions in /usr/local/lib/luarocks/rocks
-- you may want to run as a privileged user or use your local tree with --local.'
So, I execute 'sudo luarocks install luacheck', but there is also an error:
'sudo luarocks command not found'.
I confirm that luarocks has installed correctly, bucause when I execte 'luarocks --version' shows:
/usr/bin/luarocks 2.4.2
As luarocks isn't installed using the native package manager its installed to /usr/local/bin. This isn't in the PATH variable available in the sudo context - you can see (and edit) the configured paths in the secure_path property in the sudoers file.
Workaround that I use it to add a symbolic link to a path included in the secure_path property: sudo ln -s /usr/local/bin/luarocks /usr/bin/luarocks
You can either use
sudo /usr/bin/luarocks install luacheck
to install luacheck system-wide
or
luarocks --local install luacheck
to install to your user only. To use the second option, you also need to run
eval $(luarocks path --bin)
to make sure that the Lua paths are updated in your shell. To make these Lua paths permanent, you can add the above line to your shell config file (~/.bash_profile or similar).
In my CI-setup, i would like to make sure that the newest version of a given formula is installed, regardless of whether it is already installed or not.
i'm currently using something like:
brew update
brew install FORMULA || (brew upgrade FORMULA && brew cleanup FORMULA)
What are the pitfalls with that approach? Is there a nicer approach to the problem (e.g. by first querying whether FORMULA is already installed, rather than relying on brew install to fail only if FORMULA is installed)?
I you want to install a Homebrew package if it does not already exist, and upgrade it otherwise, the best solution is to use Homebrew Bundle which is officially part of the Homebrew family. If that doesn't work for you, and you want to roll your own solution, you should reference at the suggestions below.
There are other situation where a brew install might fail, other than a package already being installed. I'm not sure, but it doesn't look like the brew install command emits an exit status other than 1 on failure, so you have two options:
Search stderr for "not installed" and check against that
Use a different approach
The most common approach I've seen used for this purpose is to check if the package is installed with the command brew ls --versions:
function install_or_upgrade {
if brew ls --versions "$1" >/dev/null; then
HOMEBREW_NO_AUTO_UPDATE=1 brew upgrade "$1"
else
HOMEBREW_NO_AUTO_UPDATE=1 brew install "$1"
fi
}
You'll want to use HOMEBREW_NO_AUTO_UPDATE=1 if you're installing multiple packages so that Homebrew does not try to update in between each install/upgrade.
I've been using the following. Depending on the use case, I'll use a shell function as follows:
function smart_brew() {
HOMEBREW_NO_AUTO_UPDATE=1 brew `brew ls --versions "$1" | wc -l | xargs expr | sed 's/0/install/' | sed 's/1/upgrade/'` "$1"
}
and sometimes as a definition in a Makefile:
define smart_brew
HOMEBREW_NO_AUTO_UPDATE=1 brew `brew ls --versions "$(1)" | wc -l | xargs expr | sed 's/0/install/' | sed 's/1/upgrade/'` "$(1)"
endef
dev:
$(call smart_brew,formula)
Same basic idea
I'm following this link to install elixir and erlang on fedora 21... After i installed when i tried to run interactive elixir(iex) i get the following error
/home/hari/.asdf/installs/elixir/1.4.2/bin/elixir: line 126: exec: erl: not found
Commands i used to install :
asdf install erlang 19.0
asdf install elixir 1.3.2
But if i run as a root user its working correctly!!! What's the mistake im commiting here?
It’s a path issue. Please do the following to detect the problem root:
sudo su -c 'which erl'
#⇒ /usr/local/bin/erl # OR LIKE
It seems that this directory is not on your user’s path. Add it to test:
export PATH=`dirname $(sudo su -c 'which erl')`:$PATH
Try running elixir (it should succeed.) Now just put the hardcoded path in the very end of your shell start script (~/.bashrc if you use bash, etc):
export PATH=/usr/local/bin:$PATH
I have a Homebrew installation in $HOME/brew, and historically it has worked well. Unfortunately, over time Homebrew has become less and less tolerant of installations outside of /usr/local. Various formulae make hard assumptions about the installation prefix, and do not work properly (i.e., were not tested) with a non-standard prefix. The brew doctor command even goes so far as to warn about this now:
Warning: Your Homebrew is not installed to /usr/local
You can install Homebrew anywhere you want, but some brews may only build
correctly if you install in /usr/local. Sorry!
As such, I would now like to migrate my Homebrew installation over to /usr/local. However, I am loath to simply mv all the files, as I suspect this will cause problems. I could not find any instructions on the Homebrew site or here on migrating an existing installation to a new prefix. Of course, I could uninstall Homebrew and then reinstall it, but I would prefer not to rebuild all my kegs.
Is there any existing script or documented practice for performing such a migration?
Or is this impossible due to hardcoded absolute paths in linked binaries?
The modern way to do this is with homebrew-bundle.
brew tap Homebrew/bundle
brew bundle dump # Creates 'Brewfile' in the current directory
# later ...
brew bundle # Installs packages listed in 'Brewfile'
I just wrote a script to achieve the goal to migrate homebrew packages to a new system, which also applies for your case (named backup-homebrew.sh):
#!/bin/bash
echo '#!/bin/bash'
echo ''
echo 'failed_items=""'
echo 'function install_package() {'
echo 'echo EXECUTING: brew install $1 $2'
echo 'brew install $1 $2'
echo '[ $? -ne 0 ] && $failed_items="$failed_items $1" # package failed to install.'
echo '}'
brew tap | while read tap; do echo "brew tap $tap"; done
brew list --formula | while read item;
do
echo "install_package $item '$(brew info $item | /usr/bin/grep 'Built from source with:' | /usr/bin/sed 's/^[ \t]*Built from source with:/ /g; s/\,/ /g')'"
done
echo '[ ! -z $failed_items ] && echo The following items were failed to install: && echo $failed_items'
You should first run this script on your original system to generate a restore script:
./backup-homebrew.sh >restore-homebrew.sh && chmod +x restore-homebrew.sh
Then, after installing Homebrew on your new system (in your case the same system), simply run restore-homebrew.sh to install all those packages you have on your original system.
The benefits of this script over the one given by #ctrueden is that this script also tries to back up the installation options you used when you installed the packages.
A more detailed description is in my blog.
As suggested by Peter Eisentraut, I indeed ended up migrating my Homebrew installation by reinstalling it. You can script things a bit to retap all your extra taps, and reinstall all your previously installed kegs, without too much manual work:
#!/bin/sh
# save list of kegs for later reinstallation
brew list > kegs.txt
# back up old Homebrew installation
mv $HOME/brew $HOME/old-brew
# install Homebrew into /usr/local
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
# retap all the taps
# NB: It is not enough to move the tap repos to their new location,
# because Homebrew will not automatically recognize the new formulae.
# There might be a configuration file we could edit, but rather than
# risk an incomplete data structure, let's just retap everything.
for tapDir in $HOME/old-brew/Library/Taps/*
do (
cd $tapDir
tap=$(git remote -v | \
grep '(fetch)' | \
sed 's/.*github.com\///' | \
sed 's/ (fetch)//')
/usr/local/bin/brew tap $tap
) done
# reinstall all the kegs
/usr/local/bin/brew install $(cat kegs.txt)
# much later... ;-)
rm -rf kegs.txt $HOME/old-brew
Of course, customized Homebrew installations will have additional wrinkles. For example, if you have committed changes to any of your Homebrew-related Git repos, you may want to import that work before reinstalling your kegs or blowing away your old installation:
cd /usr/local
for f in $(find . -name '.git')
do (
repoDir=$(dirname $f)
cd $f/..
git remote add old-brew-$f $(dirname $HOME/old-brew/$f/..)
git fetch old-brew-$f
) done
Note that I only tested the second snippet above very lightly, as I personally have not customized my Homebrew in such a way.
Another aspect of Homebrew not addressed by this approach is custom flags using during your original installation. For example, to install wine you need to install various dependencies with the --universal flag, and the script above will not reinstall them with such flags enabled. See #xuhdev's answer for a solution that does so.
Or is this impossible due to hardcoded absolute paths in linked binaries?
Indeed. You'll need to reinstall everything from scratch.