TextMate & Groovy - groovy

I need help with TextMate. I installed it and want to compile Groovy within it (it seems convenient especially for trying things). I installed Groovy bundle but it doesn't work. It complains about:
Couldn't find /Applications/groovy-1.8.4/bin
If you have installed groovy, then you need to either update your PATH or set the
TM_GROOVY shell variable (e.g. in Preferences / Advanced)
Locations searched:
/Users/meir/Library/Application Support/TextMate/Pristine Copy/Bundles/Groovy.tmbundle/Suppor
/bin
/Applications/TextMate.app/Contents/SharedSupport/Support/bin/CocoaDialog.app/Contents/MacOS
/Users/meir/Library/Application Support/TextMate/Pristine Copy/Bundles/Groovy.tmbundle/Support
/bin
/Applications/TextMate.app/Contents/SharedSupport/Support/bin/CocoaDialog.app/Contents/MacOS
/usr/bin
/bin
/usr/sbin
/sbin
/Applications/groovy-1.8.4/bin
/Applications/grails-1.3.7/bin
/Applications/TextMate.app/Contents/SharedSupport/Support/bin
/Applications/TextMate.app/Contents/SharedSupport/Support/bin
I tried to do everything. I added path (/Applications/groovy-1.8.4/bin) to TM_GROOVY in settings, add to PATH variable in the same settings and I even added it to the system path but no help at all.
Please help.

To be clear you should click on TextMate > Preferences > Advanced > Shell Variables
Then add a Variable named 'TM_GROOVY' with the value being '/Applications/groovy-1.8.4/bin/groovy'
Not sure why but for my instance I actually have '.../groovy' specified explicitly.

Related

How do I fix $GOPATH/go.mod exists but should not - Linux Fedora

I am new to Golang, I am following this tutorial https://golang.org/doc/tutorial/getting-started but for some reason I keep getting this message every time I try to run the code:
$GOPATH/go.mod exists but should not
I have tried to look at answers like this one: https://stackoverflow.com/a/62062562/9785222 but I dont understand what is GOPATH and where is it.
I am using Vi as an editor on Linux Fedora
GOPATH defaults to $HOME/go on Unix.
Remove the file $HOME/go/go.mod or explicitly set $GOPATH to a different directory.
$GOPATH should point out to the src directory, in my case in Debian, I set $GOPATH to /usr/local/go/src and the problem was solved.
export $GOPATH=/usr/local/go/src
What is GOPATH ?
GOPATH is a variable that defines a folder, under which GO expects our code to reside . For more details, you can check this link

WSL PATH contains windows directories, How to (elegantly) fix it to exclude only certain ones?

I have been tinkering with WSL2 and found out that when trying to use some software, such as gcloud I bump into an annoying inconvenience.
$ gcloud
/mnt/c/google-cloud-sdk/bin/gcloud: 113: exec: python: not found
This happens because the PATH variable in WSL is set by default to include some windows directories. If we examine it, we can find /mnt/c/google-cloud-sdk/bin/gcloud amongst the set directories:
$ echo $PATH | grep /mnt/c/google-cloud-sdk/bin/
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program Files (x86)/Microsoft SDKs/Azure/CLI2/wbin:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/c/google-cloud-sdk/bin/:/mnt/c/Program Files (x86)/Microsoft SQL Server/150/DTS/Binn/:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/ProgramData/DockerDesktop/version-bin:/mnt/c/Users/iyid/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/iyid/AppData/Local/Programs/Microsoft VS Code/bin:/snap/bin
I can understand why there are some windows directories such as /mnt/c/Program Files/Docker/Docker/resources/bin, or /mnt/c/Users/iyid/AppData/Local/Programs/Microsoft VS Code/bin because I use them, but when gcloud is unusable "out-of-the-box", why include it?
So an ugly fix is to just export a new PATH variable that excludes the gcloud directory, and add this to .bashrc within the user & root home directories. Note that when replacing the path variable, I need to manually set double-quotes " around directories with spaces in it, such as "/mnt/c/Users/iyid/AppData/Local/Programs/Microsoft VS Code/bin", which makes the fix even uglier. What If I install some other software and need to include its binaries in the PATH variable? Should I just pile-up path update instructions in my .bashrc? What If I want to use zsh later-on, and I have to switch all the instructions to .zshrc? etc... All of these questions make this solution purely a "workaround" that involves a lot of maintenance overhead.
Is there a more elegant way to fix this issue?

cwm window manager - extend "exec program" search path with custom directories

I am using cwm on OpenBSD 5.6 and have got my scripts in my ~/bin folder.
In my .zshrc the PATH is also exetended with
.zshrc:
export PATH=$PATH:~/bin
If I spawn the "exec program" dialog with M-? , my scripts do not appear in the dialog.
I cannot find any docs whether cwm sources any user-specific dot-rc files. Exporting the new PATH in .profile does not heled. Also in the .cwmrc there seems to be no config option to extend the search path.
My question:
How can I configure cwm to look also in my ~/bin to find executables there?
BTW my question does not concern the "command" config for the application menu.
I just tested it and it works fine for me, although I use ksh and not zsh but that shouldn't matter. A few things to look out for:
your script has to be executable
setting the PATH manually in an xterm while already running cwm won't work, because export only exports to children and is not visible by cwm
editing .zshrc may require you to logout (and in again) for changes to become visible (not 100% certain on this, since it depends on your setup), unless you're running it manually afterwards

Advantage of $PATH over alias

I am relatively new to Linux and Unix. With the help of the internet I finally figured out how $PATH and aliases in my .bashrc work.
But I really couldn't find anything that describes when to use which.
Let's say I installed Python3.3 in Library/Frameworks and the executable is
/Library/Frameworks/Python.framework/Versions/3.3/bin/python3, but I want to execute python 3.3 just by typing python3 into my terminal.
When I understand it correctly, there are (at least) three methods to achieve this:
1) I modify $PATH in my .bashrc:
export PATH=/Library/Frameworks/Python.framework/Versions/3.3/bin:${PATH}
2) I set an alias in my .bashrc:
alias python3=/Library/Frameworks/Python.framework/Versions/3.3/bin
3) creating a symbolic link (symlink):
ln -s /Library/Frameworks/Python.framework/Versions/3.3/bin /usr/local/bin
What would you say (from your experience) is the "recommended" way?
Putting python3 in your path is the correct way to invoke it anywhere you might find yourself in your filesystem. A symbolic link is the best way to change that command to python and keep your scripts non version dependent (you can run a script that depends on python use the symbolic link and a script that needs python 3.0 specifically use python3, even though on your computer they are the same thing). Symbolic links are still files in your filesystem, so they still need to be in your path.
I only see aliases used when you are trying to create some kind of behavior that is different than the default behavior for a command line utility like an alias for ls that adds -a silently.
Also symbolic links are stored in the filesystem so once created they exist for all other users who log in, while aliases only apply to the logged in user who has defined them. They can also have file permissions applied to them.
Here is a fun article about things you can do to your terminal through your .bash_profile including some great aliases.
First, there is no reason to install Python in a /Library/Frameworks/ directory. My suggestion is that (at least for a beginner) you should not add top level directories like your /Library. If you compile it from source code, you should have built it with a standard ./configure (and it probably goes into /usr/local/)
I don't know well about compiling Python from source code, but most Linux source code gets by default ./configure-d to a /usr/local/ prefix so their binary go into /usr/local/bin/ which is often already by default in your PATH
Some Linux distributions have an /etc/profile which indirectly, if the directory $HOME/bin/ exists, adds it inside your PATH; in that case just adding binaries and scripts (or symbolic links) there is the most simple way.
My general advice is to avoid having a very long or very specific PATH. In particular, adding a directory inside your PATH for each product is IMHO a mistake. See e.g. the directory-variables section of GNU coding standards, and keep your PATH quite short. Personally I add programs only in /usr/local/bin/ (system-wide) or in $HOME/bin/, perhaps as symbolic links (so I don't change my PATH since it already contains both /usr/local/bin/ and $HOME/bin).
By past experience having a very long PATH is a nightmare, and slows down your interactive shells
Thank you all for your explanations.
As I already said, I am pretty new to Unix and Linux. I just wrote an article about those things (aliases, symlinks $PATH) for my blog for other "newbies". I like to write about those things, because they really interest me, and I want to share my experiences - I hope they are helpful to other people, too. Furthermore, it helps me to deepen my understanding if I have to explain things - and it is a good future reference, too!
It would be nice if you could skim over the article very quickly, and if I got some things wrong, I would be very happy about suggestions!
http://scientific-ocean.com/2013/02/17/an-introduction-to-linuxunix-executables-path-aliases-and-symlinks/
I would suggest go for alias which would make it easier for conflicts arising if you different versions of Python. The shell will look up the PATH variable and wherever it matches the executable of Python it will execute it. The alias has to be put in your shell profile like .bash_profile.

Choosing between multiple executables with same name in Linux

The system I am using has gnuplot installed in /usr/bin. I don't have root, but I needed a newer version of gnuplot, so I installed it to $HOME/usr/bin.
I added $HOME/usr/bin to my path, but it still executes the one in /usr/bin if I just use the gnuplot command. I'd rather not have to specify $HOME/usr/bin/gnuplot every time I have to use it.
How do I tell Linux to use the one in my home directory, and not the one in /usr/bin?
Executables are found in PATH order. You need to prepend ${HOME}/usr/bin to your path, like so:
export PATH="${HOME}/usr/bin:$PATH"
Executables are found in PATH order. Your PATH apparently is set up such that /usr/bin precedes ~/usr/bin/.
Besides modifying the PATH as has been explained, you can also use aliases like this (in BASH)
alias gn=$HOME/usr/bin/gnuplot
then you just run it with
gn
What Bombe says is ok. I would add that you should declare your user specific PATH entries inside your user's bashrc ($HOME/.bashrc), so your PATH settings only apply to your user.

Resources