You can also tell Gradle to update itself using a Gradle wrapper.
First you create the wrapper, then tell it to use the Gradle version of your choice:
./gradlew wrapper --gradle-version 4.9
Now this project will use Gradle 4.9, independent of what's installed.
However, you need to remember to run Gradle through the wrapper, i.e., run
./gradlew instead of plain
The wrapper allows you to have different projects using different Gradle versions easily.
When you commit the created wrapper to source control, everybody who checks out the project will use the same Gradle version. This can help a lot with incompatible build scripts, when something has changed between Gradle versions.