How to replace ZSH 4 with ZSH 5 - zsh

I'd like to use zsh5 instead of the old 4. So I installed 5 with homebrew:
brew install zsh
and it did download the 5.0.2 tar and installed successfully, but after I restart iTerm2, type
zsh --version
it still shows me
zsh 4.3.11 (i386-apple-darwin12.0)
I didn't remember how I installed 4, so not sure how to uninstall it? How could I remove 4 and use 5 as default?
when I looked /usr/local/Cellar/zsh/5.0.2/bin/, I see 2 files:
zsh zsh-5.0.2
Should I link zsh-5.0.2 to /bin/zsh ?

Your older zsh version may be in a location in your path with higher priority than the homebrew installation.
$ which zsh # Check what path zsh refers to
/usr/local/bin/zsh
$ ls `which zsh` # It may be a link to homebrew's cellar
lrwxr-xr-x ... /usr/local/bin/zsh -> ../Cellar/zsh/5.0.2/bin/zsh
$ echo $PATH # Make sure /usr/local is before other places in you $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
You can also check which versions homebrew has installed and which is currently active using
brew info like below. In this case there are two versions of node installed, and 0.10.13 is currently selected (see the *)
$ brew info node
node: stable 0.10.13, devel 0.11.4, HEAD
http://nodejs.org/
/usr/local/Cellar/node/0.10.12 (1104 files, 16M)
Built from source
/usr/local/Cellar/node/0.10.13 (1085 files, 15M) *
Built from source
If brew does have multiple versions listed you can switch between them using brew switch node 0.10.12 for this example.

Related

How to compile rsync on MacOS and install it (not using brew)?

As sometime I am trying to compile a full version (with all options) of rsync on MacOS (please, do not ask why I want to do it - if you can help me clear and directly, thank you so much. Otherwise, do not waste your time).
I found a really helpful script made by "junsionzhang" (https://gist.github.com/junsionzhang), which in my option is simple and direct. Thank you junsionzhang!
Even being a good script, clear, step-by-step, there are some steps that does not work for me (and I tried a lot and for a while).
Here is the script (at Oct, 16, 2022):
#Compile rsync 3.0.7
#Follow these instructions in Terminal on both the client and server to download and compile rsync 3.0.7:
#Download and unarchive rsync and its patches
cd ~/Desktop
curl -O http://rsync.samba.org/ftp/rsync/src/rsync-3.1.2.tar.gz
tar -xzvf rsync-3.1.2.tar.gz
rm rsync-3.1.2.tar.gz
curl -O http://rsync.samba.org/ftp/rsync/src/rsync-patches-3.1.2.tar.gz
tar -xzvf rsync-patches-3.1.2.tar.gz
rm rsync-patches-3.1.2.tar.gz
cd rsync-3.1.2
#Apply patches relevant to preserving Mac OS X metadata
patch -p1 <patches/fileflags.diff
patch -p1 <patches/crtimes.diff
patch -p1 <patches/hfs-compression.diff
#Configure, make, install
./prepare-source
./configure
make
sudo make install
#Verify your installation
/usr/local/bin/rsync --version
#By default, rsync will be installed in /usr/local/bin.
#If that isn't in your path, you will need to call your new version of rsync by its absolute path (/usr/local/bin/rsync).
The three patches lines does not work for me. After patching the fileflags, the rsync patched can not me "prepared", and of course, not be configured. The others, crtimes.diff and hfs-compression.diff, does not exist on the TAR package.
So, questions:
Trying to compile the 3.2.6 version os MacOS Big Sur (11.7), what do I need and which is the right/correct way and steps to patch, update and have the "correct"version?
How do I (correctly) compile and install the all the libraries to have a real full rsync version, with all features available (ACL support, Xattr support, xxhash, zstd, lz4, openssl crypto, and so on...)?
I would like to update and contribute to a new "junsionzhang" script version, making options to install a simple/standard version (rsync only) and options to install the libraries and choose for a "more complete" version, and help another Mac users and the community. How can I make this bash script?
How to install gawk, mawk, nawk, awk ( and where from (what are the differences): gawk, mawk, nawk?
Some libraries I already have installed (which I do not know if I did them right) seems to be outdated. How to I update them?
When running "./prepare-source", i get this: "make: Nothing to be done for `conf'.". Does this is right?
Thank you all! I really appreciate for all help I can get!
Completely untested (I don't run MacOS).
URLs to access the source code:
Source Version Tarballs: https://rsync.samba.org/ftp/rsync/src/
Git repository: https://github.com/WayneD/rsync
might need these pre-requisites (from INSTALL.md):
brew install automake
brew install xxhash
brew install zstd
brew install lz4
brew install openssl
code to download and extract (to ~/Desktop/rsync-3.2.6):
# Download the relevant version of Rsync and the same version of
# Rsync patches, extract them and apply the "suggested"
# patches from the original script:
cd ~/Desktop
# Rsync
curl -O https://rsync.samba.org/ftp/rsync/src/rsync-3.2.6.tar.gz
tar -xzvf rsync-3.2.6.tar.gz
rm rsync-3.2.6.tar.gz
# Patches
curl -O https://rsync.samba.org/ftp/rsync/src/rsync-patches-3.2.6.tar.gz
tar -xzvf rsync-patches-3.2.6.tar.gz
rm rsync-patches-3.2.6.tar.gz
apply the "suggested" patches, light the blue touch paper and stand back:
cd ~/Desktop/rsync-3.2.6
# Apply patches relevant to preserving Mac OS X metadata
patch -p1 <patches/fileflags.diff
patch -p1 <patches/crtimes.diff
patch -p1 <patches/hfs-compression.diff
# Configure, make, install
./prepare-source
./configure
make
sudo make install
# Verify your installation
/usr/local/bin/rsync --version

Installing Atom Editor SQLformat on a Mac for Beautify Package

I have the Atom editor installed on my Mac, with the Beautify Package. Works great for HTML,etc, but when I try to Beautify SQL it says that it needs SQLFormat, which is not installed by default. When I follow the github link it shows that SQLFormat is Python, install instructions are downalod zip and 'pip install sqlparse'. Do I need to install Python to load sqlparse? Anyone have some simple instructions on how to load on a mac?
first install sqlparse with pip ( to do this you need to have python)
pip install sqlparse
Once it's installed note down the python version with which its installed. e.g. in my case it was python3.7 / python3
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: sqlparse in ./Library/Python/3.7/lib/python/site-packages (0.4.2)
make sure /usr/local/bin/ is on your PATH variable by running echo $PATH if not add it your PATH variable.
then create a file sqlformat under /usr/local/bin/ (i.e. /usr/local/bin/sqlformat) using any editor of your choice and paste below snippet, make sure to use correct version of python and save the file
#!/bin/bash
FLAGS="$f $p $#"
exec python3 -m sqlparse $FLAGS
finally do change the file permission by
chmod 755 /usr/local/bin/sqlformat

Is it possible to use javapackager on ZuluFX for Mac

I was able to use ZuluFX 8 with javapackager on Windows. However, on a Mac I get this error:
Bundler Mac Application Image skipped because of a configuration problem: Cannot determine which JRE/JDK exists in the specified runtime directory.
Advice to fix: Point the runtime directory to one of the JDK/JRE root, the Contents/Home directory of that root, or the Contents/Home/jre directory of the JDK.
It's pretty easy to just move the package into Contents/Home but I doubt that will work as it seems there is no JRE bundled with the Mac version of ZuluFX 8. Is this something that can be worked around?
It's pretty easy to just move the package into Contents/Home but I doubt that will work as it seems there is no JRE bundled with the Mac version of ZuluFX 8.
From what I'm seeing, I'm not sure that's correct. The ZuluFx 8 archive for Mac contains a jre directory. I extracted the archive to ~/zuluFX and from there created the Contents/Home directory as required by MacOS and added a symbolic link to said jre directory there. I then set $JAVA_HOME accordingly:
$ pwd
/Users/cody/zuluFX
$ mkdir -p Contents/Home
$ ln -s ../../jre .
$ export JAVA_HOME=~/zuluFX
Then I utilized a simple javapackager example on github to test its usage (I have no other JREs/JDKs installed on this box). The example app simply dumps Java properties and environment variables in a TextArea.
I had to modify the 3build script in the example to comment out its attempt to re-set $JAVA_HOME, but otherwise, it builds successfully, with the following javapackager command:
javapackager \
-deploy -Bruntime=${JAVA_HOME} \
-native image \
-srcdir . \
-srcfiles MacJavaPropertiesApp.jar \
-outdir release \
-outfile ${APP_DIR_NAME} \
-appclass MacJavaPropertiesApp \
-name "MacJavaProperties" \
-title "MacJavaProperties" \
-nosign \
-v
When I launch the resulting app, it reports the usage of the azul/zulu jre as expected:

how to set an appropriate version for a lib when i'm building it from sources

As an example of my problem let's use libqb (https://github.com/ClusterLabs/libqb).
To install it from the sources I do the next:
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install
The problem is that the version in "/usr/lib/pkgconfig/libqb.pc" is UNDEFINED.
I suspect that I have to pass a parameter to ./configure but I don't know which one.
I do it on Debian.
There are two ways to get sources:
use git ($ git clone)
download sources in an archive
In case of using git, you won't see this problem, because it uses git to get correct version of sources during build.
In case of archive you have to create .tarball-version file in the top dir and put there version you want. For example: $ echo "0.17.0" > .tarball-version.
P.S.: there will be created .version file during build. So, if you did any changes to .tarball-version then you have to remove .version file.

Cannot source autojump script with zsh on archlinux

autojump on ArchLinux for some reason is not working in zsh.
Although If I switch to bash it works fine.
$ sudo pacman -S autojump
autojump: does not work on zsh
$ source /usr/etc/profile.d/autojump.sh
$ j
zsh: command not found: j
$ source /usr/etc/profile.d/autojump.bash
$ j
zsh: command not found: j
autojump: works on bash
$ bash
(bash) $ source /usr/etc/profile.d/autojump.bash
(bash) $ j
autojump: ...
My environment:
$ echo $SHELL
/bin/zsh
$ zsh --version
zsh 5.0.2 (x86_64-unknown-linux-gnu)
I use autojump on OS X with zsh, so it also doesn't look like a zsh specific issue to me.
Aren’t you supposed to use autojump.zsh instead?
Though from what I see the only thing autojump.sh is doing is sourcing autojump.zsh or autojump.bash from some place so it should work with .sh. Work if maintainers of arch have patched autojump.sh: it does not expect to find autojump in /usr/etc.
If it does not work with autojump.zsh, post the output of doing (set -x ; source /usr/etc/profile.d/autojump.zsh).
There is no /usr/etc/profile.d/autojump.zsh pushed when autojump is installed via pacman. I don't know why this is the case.
However, I performed, manual user installation and added autojump plugin in my zsh configuration that takes care of sourcing the file.
I have tried above the ways,but I solved this problem by add the
source ~/.autojump/etc/profile.d/autojump.zsh
because the I have not find the /usr/etc/profile.d/autojump.zsh
I had repeated trouble with Autojump in ZSH regardless of sourcing the .zsh version. I never found a decent fix and eventually chose to stick with ZSH and stop using Autojump.
My personal solution was to switch from Autojump to FASD. It has the same functionality of Autojump via the 'z' alias. It also allows for specifically jumping to either a file or directory.
FASD has been a reliable part of my ZSH setup and surpasses the functionality of Autojump. I wrote up my experiences with FASD at greater length on my blog at Civet.ws

Resources