Tag Archives: bash

Global Homebrew PATH Prefix for macOS

Based on Homebrew’s FAQ you can set prefix in PATH for all GUI apps which is not enabled by default:

user$ sudo launchctl config user path "$(brew --prefix)/bin:${PATH}"
Configuration applied. You must reboot for changes to take effect.

According to this answer. The sudo launchctl config user path <...> command updates /private/var/db/com.apple.xpc.launchd/config/user.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>PathEnvironmentVariable</key>
	<string>/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
</dict>
</plist>

You can query launchd‘s current settings via:

launchctl getenv PATH

Related: You can also query the default PATH by executing:

sysctl user.cs_path

Test script with clear environment:

env -i git commit

The Simplest MediaWiki Update Script for Single-Server MediaWiki Site

System requirements:

  • User uploads $wgUploadDirectory are stored offsite
  • Non-Docker MediaWiki with normal setup
  • Composor installed (Can be installed automatically during updating)

Goals:

  • Update MediaWiki with nearly zero downtime
  • Download and install latest tagged MediaWiki from tarball package
  • Update extensions and skins from latest git tagged branch
  • Install extension-specific dependencies during updating
Continue reading

Fix rsync “Host Key Verification Failed” in Jenkins

If you got the following error in Jenkins output using rsync:

Running "shell:sync" (shell) task
Host key verification failed.
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(605) [sender=3.0.9]
Warning: Command failed: Host key verification failed.
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(605) [sender=3.0.9]
 Use --force to continue.

Try the following:

  • su -s /bin/bash jenkins, since Jenkins install doesn’t have login shell by default on CentOS
  • ssh into target server
  • When prompt “Are you sure you want to continue connecting (yes/no)?”, type yes
  • Rerun the job