-
Notifications
You must be signed in to change notification settings - Fork 1
Using the `watch.R` file
Zoë Turner edited this page Sep 11, 2026
·
1 revision
We can use the watch.R file in RStudio to launch the Shiny app in the background which then watches the files for changes and can set off an auto-reload. The method for doing this depends on your IDE.
In RStudio:
- Open the
dev/watch.Rscript and go to the ‘Background Jobs’ tab of the console pane and click the ‘Start Background Job’ button. - Click ‘Start’ after checking that the ‘R Script’ path is pre-populated with the path to
watch.R(otherwise select it yourself). - When ready, a message will tell you to visit
http://.../in your browser.
- Your main R console remains free.
- The watcher process keeps running independently.
- You can continue running tests, inspecting objects, or editing code in the main session.
- If the app crashes, it doesn't necessarily take down your interactive workspace.
The use of Background Jobs are mostly a convenience rather than a requirement but can be very helpful when developing apps.