'Zsh: command not found: valet' - unable to install Valet - homebrew

I just tried installing valet for a very long time, - and I couldn't find any help anywhere. No matter what I tried, then it kept saying:
Zsh: command not found: valet
I'm running Zshell (instead of Bash) and OSX. I've had Brew installed for quite a while.
I'll answer this myself, - so hopefully people in the same situation can find this in the future.

I had a very similar problem under Zsh, but my solution was easier. Rather than adding ~/.composer/vendor/bin to my $PATH, I needed to use the full directory name; i.e., /Users/[your-user-name]/.composer/vendor/bin.

Everywhere it says to 'Check that your path is right'. And yup - if you haven't done that, then you should start there. The easiest way is to go to your terminal and write:
echo $PATH
... And then you should see ~/.composer/vendor/bin in between two colons in there. If that isn't there, then you should go to your ~/.bashrc-file (or ~/.zshrc-file) and add this line:
export $PATH=~/.composer/vendor/bin:$PATH
And then it may be fixed.
My problem had deeper roots, though. Even though my path was right, then I still got the error:
Zsh: command not found: valet
And if I wrote: which valet - then it (obviously) just responded with valet not found.
Removal of Composer
What fixed it was to remove all my composer-installations. Composer can be located in several different locations (and installed by brew). So in order to remove it, then do this (inspired by this post, but it lacks a couple of steps):
Remove your composer- or -composer.phar-file. You can find them by running which composer and/or which composer.phar.
Remove your .composer-folder (usually located here: ~/.composer).
Then make sure that there isn't an installation done with Homebrew (this was what I think made the collision for me). You do it by running brew unlink composer followed by brew remove composer.
Then, - if you want to be 100% sure that it's all gone, then go to your root (cd /) and run this command: find ./* -name 'composer.phar' and this find ./* -name 'composer'. That should tell you of all the locations where the Composer-installation can be installed.
When all that's removed, then you should be rid of Composer (entirely).
... Then install it again, - and see if you can get valet to work (it did for me).

The solution was adding composer bin to the path. You can use the following commands
From the terminal
export PATH="$PATH:$HOME/.composer/vendor/bin"
echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.bash_profile
source ~/.bash_profile
valet install

Issue Ubuntu: no command valet
Valet on Ubuntu:
sudo apt install libnss3-tools jq xsel
composer global require cpriego/valet-linux
.composer/vendor/cpriego/valet-linux/valet install
Now command valet should work, but if still not:
sudo cp .composer/vendor/cpriego/valet-linux/valet /usr/local/bin/

Related

Adding homebrew to $PATH without sudo privileges

I've been trying to install homebrew without admin privileges on my school MacBook (Mojave 10.14.6) for the past 2 weeks. I've seen many things on the internet, saw some scripts, tutorials, but nothing seems to help.
I used this script (did some tweaking to it like changing to a new repository and setting absolute path)
https://gist.github.com/skyl/36563a5be809e54dc139
the repository I used is
https://github.com/Homebrew/brew
my path to brew is
/Users/as.gurban-zade/Desktop/homebrew/usr/local/bin/brew
I added this to the $PATH using
echo "export PATH=/Users/as.gurban-zade/Desktop/homebrew/usr/local/bin:$PATH" >> ~/.bash_profile && source ~/.bash_profile
also tried
echo "export PATH=/Users/as.gurban-zade/Desktop/homebrew/usr/local/:$PATH" >> ~/.bash_profile && source ~/.bash_profile
After everything I did, I still get
-bash: brew: command not found
Updating OS to Catalina is possible if that would help

Ghostscript installed but not found RGhost::Config::GS[:path]='/path/to/my/gs'

I've been trying for a few hours now solve this problem and I looked everywhere for a solution and I did not find one. I'm trying to run a spec test for my project and I have the following error coming up:
RuntimeError:
Ghostscript not found in your system environment (linux-gnu).
Install it and set the variable RGhost::Config::GS[:path] with the executable.
Example: RGhost::Config::GS[:path]='/path/to/my/gs' #unix-style
RGhost::Config::GS[:path]="C:\\gs\\bin\\gswin32c.exe" #windows-style
And I do try to put RGhost::Config::GS[:path]='/usr/local/bin/gs' and it returns:
bash: RGhost::Config::GS[:path]=/usr/local/bin/gs: No such file or directory
but ghostscript is installed, I did everything (make, sudo make install, etc etc) and when I run gs -v it returns:
GPL Ghostscript 9.26 (2018-11-20)
Copyright (C) 2018 Artifex Software, Inc. All rights reserved.
When I use the user interface and search for "gs" in the "Files" application, it is found in /home/marcelle/projects/ghostscript-9.26/bin/gs and I also tried:
RGhost::Config::GS[:path]='/home/marcelle/projects/ghostscript-9.26/bin/gs'
and it returns the same error:
bash: RGhost::Config::GS[:path]=/home/marcelle/projects/ghostscript-9.26/bin/gs: No such file or directory
I also tried to delete ghostscript from my notebook with autoremove and purge and installed it again using what I mentioned before (./configure, make, sudo make install), restarted the notebook, the terminal and nothing.
PS: I'm using Ubuntu 20.04.
I managed to figure out a solution. Looking for the code for the Rghost, what I saw in its spec is that the path expected was different than the path the ghostscript really is.
When I run whereis or which on my terminal, it returns:
which gs
/usr/local/bin/gs
So I was trying to point to this path. But seeing the spec test for Rghost which I found on github for Rghost, we can see that it expects /usr/bin/gs:
it 'should detect linux env properly' do
RbConfig::CONFIG.should_receive(:[]).twice.with('host_os').and_return('linux')
File.should_receive(:exists?).with('/usr/bin/gs').and_return(true)
RGhost::Config.config_platform
RGhost::Config::GS[:path].should == '/usr/bin/gs'
end
So it expects /usr/bin and not /usr/local/bin.
Then I just copied to that path and the spec ran with no problems anymore:
sudo cp /usr/local/bin/gs /usr/bin
I've no experience with Ruby at all, but I also got this error when using asciidoctor, which uses rghost for the PDF generation.
The command RGhost::Config::GS[:path]='/path/to/my/gs' mentioned in the error is not a shell command, which is why bash couldn't handle it. However, to me it wasn't immediately clear what to do with this command either. I expected an easy way to set this variable somewhere, but couldn't find it.
What worked for me was searching the rghost.rb file, which is where this variable is set and can be changed. In Windows, it was located in C:\Ruby30-x64\lib\ruby\gems\3.0.0\gems\rghost-0.9.7\lib\rghost.rb.
In this file, I added the following line, which solved the problem:
RGhost::Config::GS[:path]="C:\\Program Files\\gs\\gs9.55.0\\bin\\gswin64c.exe"
NB: the mentioned paths can be different for everyone, so make sure to use that paths that are valid for your system.

asdf-erlang doesn't install man pages

I am using asdf + asdf-erlang as my version manager for Erlang. All seems to be working fine, except that typing erl -man mnesia results in No manual entry for mnesia.
I have installed all dependencies mentioned on the asdf-erlang github page. I have also installed xsltproc and fop. Unfortunately "man" folder located under ~/.asdf/installs/erlang/18.3/lib/erlang/erts-73/ is empty. I haven't found man pages being generated elsewhere.
I was trying to locate build log, but I was not successful with that either.
I am using 64bit Ubuntu 16.10 & 16.04.
OK. I finally managed to resolve the issue:
Go to https://www.erlang.org/downloads/ and download manpages for the version(s) of Erlang you have installed using asdf (so for 18.3 you're looking for: http://erlang.org/download/otp_doc_man_18.3.tar.gz)
Copy man folder with its content (extracted from the archive) to ~/.asdf/installs/erlang/<version>/lib/erlang/. After doing so, you should have .~/asdf/installs/erlang/<version>/lib/erlang/man containing man1, man3, man4, man6, man7 (and each of those folders should have some manpages in it).
Repeating steps above for all the versions installed using asdf, allows you to use manpages for specific version of Erlang you are using at the moment.
looks like erlang-manpages are not included in the asdf-erlang since you are using ubuntu i would suggest you add Erlang Solutions repository to your system, call the following commands:
wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb
sudo dpkg -i erlang-solutions_1.0_all.deb
sudo apt-get update
then install erlang-manpages:
sudo apt-get install erlang-manpages
you could also install erlang-doc — HTML/PDF documentation
sudo apt-get install erlang-doc
check this page for more information
The man path in #MaciekTalaska 's answer seems not correct, it does not work at all, for erlang 18.3.
After reading ASDF's activate script(), here's one statement:
_KERL_MANPATH_REMOVABLE="$HOME/.asdf/installs/erlang/18.3/lib/erlang/man:$HOME/.asdf/installs/erlang/18.3/man"
Therefore, you just need to:
Go to https://www.erlang.org/downloads/ and download manpages for the version(s) of Erlang you have installed using asdf (so for 18.3 you're looking for: http://erlang.org/download/otp_doc_man_18.3.tar.gz)
Copy man folder with its content (extracted from the archive) to $HOME/.asdf/installs/erlang/${version}, but not $HOME/.asdf/installs/erlang/${version}/lib/erlang/ (in fact, there isn't a folder named erlang under lib).

Modularizing and distributing bash script via Homebrew

Context
I have some functions defined in my ~/.bashrc which I'd like to turn into a Homebrew package. Currently, these functions act as custom commands on my command line:
# .bashrc
function foo() {
# do something interesting
}
# at terminal
$ foo
# => does the interesting thing
Approach
I've created a homebrew formula using brew create. My current approach is as follows:
Move the function definitions into a separate file, script, within a directory, brew-script
Make brew-script downloadable as a tarball, brew-script.tar.gz
Have my brew formula append text to the end of ~/.bash_profile to include script when terminal session starts
Concerns
Is modifying .bash_profile in a brew formula bad practice? (eg. when uninstalling with brew uninstall script, brew should somehow remove the text that was appended to .bash_profile... Parsing .bash_profile doesn't seem very fun.)
Is there a convention already established for including functions in bash scripts so that they are available from the command line?
Is it common to simply ask the user to add some text to their .bash_profile or .bashrc?
Desired result
Should be able to install cleanly with brew and then run foo as a command:
$ brew install script
$ foo
# => does the interesting thing
(Assume the brew formula is already installed locally. I'll worry about auditing and pushing the formula to homebrew later)
Refer https://github.com/Homebrew/homebrew/issues/50232 and https://github.com/Homebrew/homebrew/issues/50231.
I have a script that safely‡ modifies ~/.bash_profile as part of a homebrew install process. https://github.com/paul-hammant/homebrew-tap/blob/master/switchjdk.rb
‡ allegedly
Without using homebrew:
to put your bash scripts in some file such as bashrc or any other name works, then put the following line:
source "path/to/brew-script/script"
somewhere in your bash profile.
Then you just have to make sure you refresh or reload your bash profile by running . ~/.bash_profile or source ~/.bash_profile.
How homebrew installs work:
When you installed homebrew it added a line to your bash_profile that modifies your $PATH variable to include the path to the homebrew install repo, so that whenever brew installs something it becomes findable through your PATH.
If you use brew create you must have your script uploaded somewhere on the internet, because the argument brew install takes is a URL. I.e if I create my script at my_bash_function.tar.gz then I would do
brew create http://web.mit.edu/dianah13/www/my_bash_function.tar.gz
It also templates a pull request to include your package in homebrew's main repo.

RVM not found, after installing RVM

I've found a couple similar posts regarding this same problem, but none of the solutions seem to apply, here.
On a fresh Ubuntu 10.10 install, I follow the instructions for installing RVM:
$ bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
Then I create .bash_profile and add the following line:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
I restart the terminal and check RVM:
$ type rvm | head -1
-bash: type: rvm: not found
As the RVM installation guide explains to do so, I replaced the first line (below) in .bashrc with the second one, then indented everything in the rest of the file and added a fi.
[ -z "$PS1" ] && return # original
if [[ -n "$PS1" ]]; then # replaced with this
Restarted terminal and still, no luck.
Then, I removed the line I added to .bash_profile in the beginning and added it to .bashrc, even though that isn't what the guide said to do. Still, no luck. I also entered it directly on the command line, with no change in behavior. When I run .rvm from ~/.rvm/bin/rvm it complains that there is no such file or directory as /.rvm/scripts/rvm and that the command was not fund.
Of course, there isn't any such "scripts" directory inside of ./rvm, either -- so I'm not sure why it's looking for one? The only directories inside of .rvm are
archives
bin
config
gems
gemsets
log
man
rubies
src
tmp
user
The only thing I've found while googling for answers are other people complaining of similar problems and people telling them to add the instructed line to .bash_profile (which I obviously already did). At this point, I have nothing more to go on and am at an impasse.
Regards.
Resolution:
As Andrew Marshall advised in his comments, below, I did an 'rm -rf .rvm' and reinstalled rvm. I had actually attempted this two times before posting here, with the same results every time. No odd messages in the install log, but no /scripts/ directory, either. Just so I could say I had, I did it a third time at Andrew's urging. This time, I checked and the /scripts/ directory existed. Running 'type rvm | head -1' confirmed it as a 'function' and I can now move on.
Make sure that you restart a session after reinstalling, so that rvm is in your path.
You can try to logout/login.
You can also open your shell as a login shell. Under ubuntu 12.04:
Open a terminal
Edit > Profile Preferences
Under tab Title and Command, check run Command as a login shell
Open new terminal (ctrl+alt+t) and type rvm
If there's no scripts directory inside .rvm, it would seem that RVM failed to successfully complete installation. Delete the .rvm directory, try reinstalling, and look at the installation output closely to see if it's complaining about anything.

Resources