Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

tiiiecherle

macrumors newbie
Original poster
Sep 13, 2015
19
16
Hey to every macOS user,

I am following this forum for a long time for different topics but I am not posting a lot. I spent a lot of time on each macOS release to work on installing and customizing macOS with scripts and I thought in favor of 10.15 right around the corner I share these many hours of work with the community ;)

It deals with a lot of questions and problems that are discussed here and I hope it helps anyone. I read the forum rules and I don`t want to promote anything but I would be happy to help, share and discuss this macOS stuff. The github project starts with creating an usb install volume, resetting and automatically adjusting network settings, setting almost all system preferences, the dock and other tweaks with the command line and contains a backup / restore script.

This year the update was huge due to introducing batch scripts and changing from bash to zsh as default shell.

Head over to github so you get a better impression what it is all about.

https://github.com/tiiiecherle/osx_install_config

Happy installing and customizing :)
 
  • Like
Reactions: bogdanw
Thank you for the comprehensive work. I'm interested in testing the hosts update part, but I'm not sure how to install https://github.com/tiiiecherle/osx_...r/09_launchd/9b_run_on_boot/root/1_hosts_file

Hey, just download the github repo (e.g. on the green button "clone or download") or check it out via command line.

Leave the structure of the files and folders in place (this is important) and run this script in Terminal from the local downloaded repo:

https://github.com/tiiiecherle/osx_...ll_hosts_file_generator_and_launchdservice.sh

When asked for installing the config file, press "y" and enter (this has to be done only once, the config file will ask for an update if I update it on my github repo). The install script then installs the launchd service and the install/update file and automatically updates the /etc/hosts file every 4th day.

Please let me know if it worked for you.

Have a nice Sunday ;)
 
After installing Python 3.7.4, it worked. I'll report back in 4 days. Have a nice week :)
Perfect. Sorry, I forgot about that as I install all the script dependencies via homebrew upfront. But the script should give a feedback that python3 is missing.
I´m glad you figured it out. The launchd will try an update every time you switch on your mac or at 11 a.m. each day. You should see a feedback in the logfile (open by typing "open /var/log/hosts_file_generator.log" in the terminal. When the 4 days are over and you are online there should be a successful update ;)
Thanks, have a nice week, too:)
 
When the 4 days are over and you are online there should be a successful update ;)
Four days have passed and there was a successful update. 👍
However, the log shows Problem getting file and Error in updating source for every source, I've attached the log.
I've added an address to the whitelist file, but I don't know if it was excluded by the script or is just not included in the hosts anymore. I remember seeing whitelist file mentioned when I first run the script, but I can't find it in the log.
 
Last edited:
Four days have passed and there was a successful update. 👍
However, the log shows Problem getting file and Error in updating source for every source, I've attached the log.
I've added an address to the whitelist file, but I don't know if it was excluded by the script or is just not included in the hosts anymore. I remember seeing whitelist file mentioned when I first run the script, but I can't find it in the log.

I just looked at my logs and everything seems ok.

I don't really know but according to this
https://github.com/StevenBlack/hosts/issues/904
it looks like an issue on the project side.

What you could try is just to run the install script again (resets everything in the process and see if it gets the files successfully. If not (I only use it with the homebrew python version and I saw you installed python3 via python3 macOS package) please try...
1 Uninstall python3
2 Install homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
3 Install python3 via homebrew
brew install python
4 run install script again
This way the script is working for me for a long time.

Happy to hear a short feedback if one of these two methods worked for you. Using it with homebrew python (perhaps it has something to do with python requirements that get installed from the project) is used on more systems I admin and it seems to work reliably everywhere.
 
The hosts file was updated again, but with the same messages.
I couldn't install Python 2 or 3 with homebrew, it gave these errors on 10.15.1 Beta (19B68f)
brew install python
Error: The following formula
python
cannot be installed as binary package and must be built from source.
Install the Command Line Tools:
xcode-select --install
xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
However, I've reinstalled Python 3.8, updated pip and run sudo /Library/Scripts/custom/hosts_file_generator.sh
No more "Problem getting file" and "Error in updating source" this time.
 
The hosts file was updated again, but with the same messages.
I couldn't install Python 2 or 3 with homebrew, it gave these errors on 10.15.1 Beta (19B68f)


However, I've reinstalled Python 3.8, updated pip and run sudo /Library/Scripts/custom/hosts_file_generator.sh
No more "Problem getting file" and "Error in updating source" this time.

I`m glad you figured it out. I´m sorry I forgot the step for installing command line tools, there is also a script for that in my repo.

https://github.com/tiiiecherle/osx_...casks_and_mas_install/2_command_line_tools.sh
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.