- Create personal access tokens
https://github.com/settings/tokens - Generate a new token and copy it
- Open Keychain Access
- Update GitHub password with the new generated token
- Use the same token when cloning for the first time using the terminal.
Code sign and creating a notarization request
Requirements
- XCode Installed
- Apple Id Account app-specific Password (https://support.apple.com/en-us/HT204397)
- Apple Developer ID Application Certificate created and installed in keychain (https://developer.apple.com/support/developer-id/)
1. Create a new application specific password in Apple ID portal for your developer account at https://appleid.apple.com You will only be shown the password when you create it
2. Open keychain Access, from menu select File and then “New Password Item”.
* Keychain Item Name: Developer-altool
* Account Name: your developer account email
* Password: the application-specific password you just created
This will create a developer specific password item that we can access safely from the tools used in the bash script.
3. Create the dmg file
macdeployqt PRO_FILE -appstore-compliant -verbose=0 -dmg -qmldir=SRC_FOLDER
4. Run the “MacOS Application Notarization Script” script by Rendy Del Rosario
#!/bin/bash
usage()
{
# Display Help
echo "*********************************************************************************************************************************************************"
echo " MacOS Application Notarization Script"
echo "*********************************************************************************************************************************************************"
echo
echo " Requirements"
echo " - XCode Installed"
echo " - Apple Id Account app-specific Password (https://support.apple.com/en-us/HT204397)"
echo " - Apple Developer ID Application Certificate created and installed in keychain (https://developer.apple.com/support/developer-id/)"
echo
echo " Instructions"
echo " 1. Run notarize option to code sign application and create notarization request"
echo " 2. Run check option with the request UUID of the previous step to check the notarization status"
echo " 3. Run staple option only if the notarization status was successful and package was approved"
echo " 4. You are now ready to distribute, if you want to create an installer you can use this option https://github.com/sindresorhus/create-dmg."
echo " Note that if you distribute your app in a .dmg, follow these steps:"
echo
echo " - Add your notarized and stapled app to the DMG."
echo " - Notarize your .dmg file."
echo " Example: sh $0 --notarize -a MyApp.dmg -b com.company.myapp -u myappleaccount@gmail.com -p aaaa-aaaa-aaaa-aaa -v FFFFFFFF)"
echo " - Staple the notarization to the .dmg file: xcrun stapler staple MyApp.dmg."
echo " Example: sh $0 --staple --file MyApp.dmg"
echo "________________________________________________________________________________________________________________________________________________________"
echo
echo " Usage"
echo " $0 [-n|s|c] [ -a APP_NAME ] [ -i SIGNING_IDENTITY ] [ -e ENTITLEMENTS ] [ -b BUNDLE_ID ] [ -u USERNAME ] [ -p PASSWORD ] [ -v PROVIDER ] [ -k UUID ]"
echo
echo "________________________________________________________________________________________________________________________________________________________"
echo
echo " Options:"
echo
notarizeHelp
checkHelp
stapleHelp
return
}
notarizeHelp()
{
echo " ======================================================================="
echo " -n | --notarize Notarize file"
echo " ======================================================================="
echo " Syntax:"
echo " [ -n | --notarize ] [ -a | --file APP_NAME ] [ -i SIGNING_IDENTITY ] [ -e ENTITLEMENTS ] [ -b BUNDLE_ID ] [ -u USERNAME ] [ -p PASSWORD ] [ -v PROVIDER ]"
echo " Parameters:"
echo " [ -a | --file ] - File name"
echo " [ -i ] - Apple Signing identity"
echo " [ -e ] - Application entitlements file"
echo " [ -b ] - Application Bundle identifier"
echo " [ -u ] - Apple Developer ID Username"
echo " [ -p ] - Application Specific password"
echo " [ -v ] - Access Provider"
echo " Example:"
echo " .app sh $0 --notarize -a MyApp.app -b com.company.myapp -u myappleaccount@gmail.com -p aaaa-aaaa-aaaa-aaa -v FFFFFFFF -e App.entitlements -i \"Developer ID Application: COMPANY\""
echo " .zip sh $0 --notarize -a MyApp.app.zip -b com.company.myapp -u myappleaccount@gmail.com -p aaaa-aaaa-aaaa-aaa -v FFFFFFFF"
echo " .dmg sh $0 --notarize -a MyApp.dmg -b com.company.myapp -u myappleaccount@gmail.com -p aaaa-aaaa-aaaa-aaa -v FFFFFFFF"
echo
}
checkHelp()
{
echo " ======================================================================="
echo " -c | --check Check notarization status"
echo " ======================================================================="
echo " Syntax:"
echo " [ -c | --check ] [ -u USERNAME ] [ -p PASSWORD ] [ -k UUID ]"
echo " Parameters:"
echo " [ -u ] - Apple Developer ID Username"
echo " [ -p ] - Application Specific password"
echo " [ -k ] - Notarization Request UUID"
echo " Example:"
echo " sh $0 --check -u myappleaccount@gmail.com -p aaaa-aaaa-aaaa-aaa -k ffff-ffffff-ffffff-ffffffffff"
echo
}
stapleHelp()
{
echo " ======================================================================="
echo " -s | --staple Staple file"
echo " ======================================================================="
echo " Syntax:"
echo " [ -s | --staple ] [ -a | --file APP_NAME ]"
echo " Parameters:"
echo " [ -a | --file ] - File name"
echo " Example:"
echo " sh $0 --staple --file MyApp.app"
echo
}
#Help Dictionary
helpFunction()
{
echo ""
usage
exit 1
}
# Transform long options to short ones
for arg in "$@"; do
shift
case "$arg" in
"--notarize") set -- "$@" "-n" ;;
"--staple") set -- "$@" "-s" ;;
"--check") set -- "$@" "-c" ;;
"--file") set -- "$@" "-a" ;;
*) set -- "$@" "$arg"
esac
done
while getopts "nsca:i:e:b:v:u:k:p:" option
do
case "${option}"
in
n) ACTION=NOTARIZE;;
s) ACTION=STAPLE;;
c) ACTION=CHECK;;
a) APP_NAME=${OPTARG};;
i) SIGNING_IDENTITY=${OPTARG};;
e) ENTITLEMENTS=${OPTARG};;
b) BUNDLE_ID=${OPTARG};;
p) PASSWORD=${OPTARG};;
v) PROVIDER=${OPTARG};;
u) USERNAME=${OPTARG};;
k) UUID=${OPTARG};;
?) helpFunction ;;
esac
done
do_check()
{
echo "$UUID"
if [ -z "${UUID}" ]; then
echo "[Error] Didn't specify notarization request UUID";
fi
if [ -z "${USERNAME}" ]; then
echo "[Error] Apple ID username is required";
fi
if [ -z "${PASSWORD}" ]; then
echo "[Error] App Specific password is required";
fi
if [ -z "${UUID}" ] || [ -z "${USERNAME}" ] || [ -z "${PASSWORD}" ]; then
echo
checkHelp
exit 1
fi
echo "[INFO] Checking Notarization status for $UUID"
xcrun altool --notarization-info "$UUID" -u "$USERNAME" -p "$PASSWORD" --output-format xml
exit 1
}
sign()
{
if [ -z "${APP_NAME}" ]; then
echo "[Error] Didn't specify a filename";
fi
if [ -z "${SIGNING_IDENTITY}" ]; then
echo "[Error] Didn't specify signing identity";
fi
if [ -z "${ENTITLEMENTS}" ]; then
echo "[Error] Didn't specify entitlements file";
fi
if [ -z "${BUNDLE_ID}" ]; then
echo "[Error] Didn't specify bundle identifier";
fi
if [ -z "${PROVIDER}" ]; then
echo "[Error] Didn't specify access provider";
fi
if [ -z "${USERNAME}" ]; then
echo "[Error] Apple ID username is required";
fi
if [ -z "${PASSWORD}" ]; then
echo "[Error] App Specific password is required";
fi
if [ -z "${APP_NAME}" ] || [ -z "${USERNAME}" ] || [ -z "${PASSWORD}" ] || [ -z "${PROVIDER}" ] || [ -z "${ENTITLEMENTS}" ] || [ -z "${SIGNING_IDENTITY}" ]; then
echo
notarizeHelp
exit 1
fi
echo "[INFO] Signing app contents"
find "$APP_NAME/Contents"|while read fname; do
if [[ -f $fname ]]; then
echo "[INFO] Signing $fname"
codesign --force --timestamp --options=runtime --entitlements "$ENTITLEMENTS" --sign "$SIGNING_IDENTITY" $fname
fi
done
echo "[INFO] Signing app file"
codesign --force --timestamp --options=runtime --entitlements "$ENTITLEMENTS" --sign "$SIGNING_IDENTITY" "$APP_NAME"
echo "[INFO] Verifying Code Sign"
codesign --verify --verbose "$APP_NAME"
echo "[INFO] Zipping $APP_NAME to ${APP_NAME}.zip"
ditto -c -k --rsrc --keepParent "$APP_NAME" "${APP_NAME}.zip"
#echo "[INFO] Uploading $APP_NAME for notarization"
#xcrun altool --notarize-app -t osx -f "${APP_NAME}.zip" --primary-bundle-id "$BUNDLE_ID" -u "$USERNAME" -p "$PASSWORD" --asc-provider "$PROVIDER" --output-format xml
notarizationUpload "${APP_NAME}.zip"
}
notarize()
{
if [ -z "${APP_NAME}" ]; then
echo "[Error] Didn't specify a filename";
fi
if [ -z "${BUNDLE_ID}" ]; then
echo "[Error] Didn't specify bundle identifier";
fi
if [ -z "${PROVIDER}" ]; then
echo "[Error] Didn't specify access provider";
fi
if [ -z "${USERNAME}" ]; then
echo "[Error] Apple ID username is required";
fi
if [ -z "${PASSWORD}" ]; then
echo "[Error] App Specific password is required";
fi
if [ -z "${APP_NAME}" ] || [ -z "${USERNAME}" ] || [ -z "${BUNDLE_ID}" ] || [ -z "${PASSWORD}" ] || [ -z "${PROVIDER}" ]; then
echo
notarizeHelp
exit 1
fi
case "$APP_NAME" in
*.app) sign;;
*.zip) notarizationUpload "$APP_NAME";;
*.dmg) notarizationUpload "$APP_NAME";;
esac
}
notarizationUpload()
{
echo "[INFO] Uploading $APP_NAME for notarization"
xcrun altool --notarize-app -t osx -f "$1" --primary-bundle-id "$BUNDLE_ID" -u "$USERNAME" -p "$PASSWORD" --asc-provider "$PROVIDER" --output-format xml
}
do_staple()
{
if [ -z "${APP_NAME}" ]; then
echo "[Error] Didn't specify a filename";
echo
stapleHelp
exit 1
fi
echo "[INFO] Stapling $APP_NAME"
xcrun stapler staple "$APP_NAME"
echo "[INFO] Validating Staple for $APP_NAME"
xcrun stapler validate "$APP_NAME"
}
#Excute Action base on the option -s -n -c
case $ACTION in
STAPLE) do_staple;;
CHECK) do_check;;
NOTARIZE) notarize;;
*) helpFunction;
esac
unset APP_NAME ACTION SIGNING_IDENTITY BUNDLE_ID ENTITLEMENTS USERNAME PASSWORD PROVIDER UUID
Big thanks to Rendy Del Rosario https://stackoverflow.com/users/4700871/rendy-del-rosario
Install MySQL using Homebrew, open the terminal an type in:
$ brew install mysql
Start MySQL server by typing
$ brew services start mysql
Secure the server by typing
$ mysql_secure_installation
When using brew services start mysql the server will re-start at OS reboot, if you run:
$ brew services stop mysql
This will stop MySQL and not re-start after a OS reboot.
You can also avoid this by typing:
$ mysql.server start
This will start MySQL and keep it running until computer shutdown or by typing:
$ mysql.server stop
Connect to server
$ mysql -u root -p
The deployment tool can be found at
$ QTDIR/{VERSION}/{COMPILER}/bin/macdeployqt
How to use the macdeployqt tool using the terminal.
Option | Description |
-verbose=<0-3> | 0 = no output, 1 = error/warning (default), 2 = normal, 3 = debug |
-no-plugins | Skip plugin deployment |
-dmg | Create a .dmg disk image |
-no-strip | Don’t run ‘strip’ on the binaries |
-use-debug-libs | Deploy with debug versions of frameworks and plugins (implies -no-strip) |
-executable= | Let the given executable also use the deployed frameworks |
-qmldir= | Deploy imports used by .qml files in the given path |
$ QTDIR/{VERSION}/{COMPILER}/bin/macdeployqt <path to app file generated by build>/appFile.app
.bash_profile not working on macOS?
First check if Bash is the default shell:
echo $SHELL
If /bin/bash is not returned, just change it by typing:
chsh -s /bin/bash
Restart your terminal or type in:
source ~/.bash_profile
Samba on Ubuntu, using Mac
On Ubuntu
Open the terminal and run:
sudo apt update
sudo apt install samba
sudo nano /etc/samba/smb.conf
At the end of the file, add the following lines:
[sambashare]
comment = Samba on Ubuntu
path = /home/username/sambashare
read only = no
browsable = yes
Restart samba
sudo service smbd restart
Update firewall rules to allow Samba traffic:
sudo ufw allow samba
Set the samba password for the Ubuntu user
sudo smbpasswd -a username
On Mac:
Open finder and press COMMAND+k, this will open the window “Connect to server”, enter the URL:
smb://server-ip/sambashare
PostgreSQL import database
Postgres login (localhost):
sudo -u postgres psql
Postgres login (external host):
psql -h EXTERNAL_HOST_IP -d DB_NAME -U postgres
Listing databases:
postgres=# \l
Switching databases:
postgres=# \c DB_NAME
Listing tables:
DB_NAME=# \dt
Creating database, user and adding access on PostgreSQL
Create a new database:
postgres=# create database DB_NAME;
Create a new database user:
postgres=# create user USER_NAME with encrypted password 'USER_PASSWORD';
Grant access on database for the user
postgres=# grant all privileges on database DB_NAME to USER_NAME
PostgreSQL import database:
sudo -u POSTGRESQL_USER psql -h HOST_IP -d DB_NAME < SQL_FILE.sql
Current working branch:
git branch
* master
Working on a different branch:
git checkout -b ANOTHER_BRANCH
Switched to a new branch 'ANOTHER_BRANCH'
Check if there are some new commits on master:
git checkout master
git pull
Merge changes
The easiest approach for merging the changes would be:
git checkout ANOTHER_BRANCH
git merge master
If there are differences, then merge will apply the commits to the top of ANOTHER_BRANCH and create a new merge commit. Otherwise, the merge will be resolved by a fast-forward.
Rebase
git checkout ANOTHER_BRANCH
git rebase master
Rebase moves all diverging commits of ANOTHER_BRANCH to the top. The diverging commits will have new hashes because history will be rewritten. Accordingly, if you’ve previously pushed your feature branch to remote, then the only way to update it is with force push.